- 博客(92)
- 收藏
- 关注

原创 winform 以光标指向点为中心 通过鼠标滚轮对图片进行缩放
最近一个项目需要涉及到图片的全屏显示以及缩放拖动功能,其中缩放实现需要考虑的一点就是为了有更好的用户体验,需要在缩放的时候以光标所处位置为参考点,进行缩放操作,简单来说就是,缩放前后光标在图片上所处的位置保持不变。实现原理:把图片放在picturebox中,通过一系列调整,使图片完全占满box,每次通过改变box的size来使得图片放大缩小,然后再通过改变box的locaton使得光标位置不变。具
2016-08-18 14:22:05
9937
5

原创 巴什博弈
题目背景: 有一堆物品,供n个,两个人A,B轮流取,A先取,每次至少取1个,至多可以取n个,取到最后一个物品的人获胜,假设两人每次都采取对自己最有利的取法,问最后谁能获胜。问题分析: 博弈问题一般的思路是先找“胜负手”,即轮到某方时某方必胜的局面,在这个问题中,显然当剩余物品的数量<=m时必胜,但是,因为博弈双方都不是傻子,必定只有在迫不得已的情况下让对方得到必胜的局面,此种局面,便是
2016-03-26 16:35:12
525
原创 CKA认证的含金量
1. 什么是CKA认证?The Certified Kubernetes Administrator (CKA) program was created by the Cloud Native Computing Foundation (CNCF), in collaboration with The Linux Foundation, to help develop the Kubernetes ecosystem.As one of the highest velocity open source.
2021-07-19 18:26:59
6379
1
原创 最简单解决c#在UI线程中执行耗时方法导致界面假死的方法
int sta = my_connect.login(_user_name, _password);如上,login方法中通过http向服务器发请求,在网络状况不好或者服务器繁忙的时候,会因为迟迟等不到返回结果导致页面假死。解决办法:int sta = await Task.Run(() => { return my_connect.logi
2016-10-30 21:00:50
7770
原创 最简单解决c#在UI线程中执行耗时方法导致界面假死的方法
int sta = my_connect.login(_user_name, _password);如上,login方法中通过http向服务器发请求,在网络状况不好或者服务器繁忙的时候,会因为迟迟等不到返回结果导致页面假死。解决办法:int sta = await Task.Run(() => { return my_connect.logi
2016-10-30 20:37:19
18473
转载 WPF 高质量教程(转载自圣殿骑士)
WPF 基础到企业应用系列1——开篇有益 http://knightswarrior.blog.51cto.com/1792698/343871 WPF 基础到企业应用系列2——WPF前世今生 http://knightswarrior.blog.51cto.com/1792698/344622WPF 基础到企业应用系列3——WPF开发漫谈 http://knightswarrior.bl
2016-09-30 12:54:32
15678
原创 winform 快捷键的两种实现方法
方法1:只当焦点在当前控件上有效 private void pictureBox1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) { if (e.KeyCode == Keys.Escape) this.Dispose();
2016-08-18 14:29:47
5883
原创 winform 鼠标拖动移动图片位置
三个事件,与图片的控件容器绑定、即可实现鼠标拖动移动图片位置 private void pbMain_MouseDown(object sender, MouseEventArgs e) { photo_rec = photo_show1.GetPictureBoxZoomSize(pictureBox1); pt =
2016-08-18 14:24:44
3576
1
原创 git pull时出现冲突 放弃本地修改,使远程库内容强制覆盖本地代码
git fetch --all //只是下载代码到本地,不进行合并操作git reset --hard origin/master //把HEAD指向最新下载的版本
2016-08-18 13:50:10
62276
1
原创 winform tabControl隐藏顶部按钮
this.tabControl1.Region = new Region(new RectangleF(this.tabPage1.Left, this.tabPage1.Top, this.tabPage1.Width, this.tabPage1.Height));但是这样并不能完全隐藏,通过 Tab + Ctrl 就可以切换TabControl中的tabpage 可以通过重写相关函数,捕捉
2016-06-28 23:25:23
4675
原创 二分图最大匹配
二分图最大匹配#include<iostream>#include<stdio.h>#include<cmath>#include<algorithm>#include<string>#include<cstring>#include<string.h>#include<map>#include<queue>#include<stack>#include<list>#incl
2016-05-25 17:22:57
315
原创 最大m子段和模板
最大m子段和模板 int max(int *a,int m,int n)//a为初始数据 m为段数 n为数据长度,数据从下标1开始 { int *c; int *p; int max1, i, j; c=new int[n+1]; p=new int[n+1]; for(i=0; i
2016-05-25 17:21:22
338
原创 并查集
并查集void make(int x){ for (int i = 0; i <= x; i++) p[i] = i;}int find(int x){ if (x != p[x]) p[x] = find(p[x]); return p[x];}void unio(int x, int y){ int px = fin
2016-05-25 17:21:01
292
原创 大数类模板
大数类模板#define MAXN 9999 #define MAXSIZE 10 #define DLEN 4 class BigNum{private: int a[500]; //可以控制大数的位数 int len; //大数长度 public: BigNum(){ len = 1; memset(a, 0, sizeof(a
2016-05-25 17:20:35
391
原创 ACM头文件
ACM头文件#include<iostream>#include<stdio.h>#include<cmath>#include<algorithm>#include<string>#include<cstring>#include<string.h>#include<map>#include<queue>#include<stack>#include<list>#inclu
2016-05-25 17:20:06
920
原创 最长公共递增子序列
最长公共递增子序列int LCIS(){ int ans = 0; for (int i = 1; i <= n; i++) { int k = 0; for (int j = 1; j <= m; j++) { if (a[i] == b[j]) {
2016-05-25 17:19:14
363
原创 最长递增子序列
最长递增子序列int lis[1005];//保存在下标之前包括下标元素在内的的序列中最长自序列,必须包括下标在内。int list(int arr[],int n) //n^2算法 下标从1开始 最长递增{ int i,j,max; max = 0; for(i=1;i<=n;i++) lis[i] = 1; for(
2016-05-25 17:18:50
126
原创 排序函数
排序函数bool compare(int a,int b){ return a<b; //升序排列,如果改为return a>b,则为降序}升序:sort(begin,end,less<data-type>()); 降序:sort(begin,end,greater<data-type>()). bool cmpare(mas x,mas y){if(x.weigt!=
2016-05-25 17:17:58
401
原创 ASCII码表 0-127
ASCII码表 0-127Bin Dec Hex 缩写/字符 解释 00000000 0 00 NUL(null) 空字符 00000001 1 01 SOH(start of headling) 标题开始 00000010 2 02 STX (start of text) 正文开始 00000011 3 03 ETX (end of text) 正文结束 00000100
2016-05-25 17:17:39
924
原创 快速幂函数
快速幂函数__int64 multimod(__int64 x, __int64 n, __int64 mod){ __int64 tmp = x, res = 1LL; while (n) { if (n & 1LL) { res *= tmp; res %= mod; }
2016-05-25 17:17:15
385
原创 矩阵快速幂
矩阵快速幂#include <cstdio>#include <iostream>using namespace std;const int MOD = 10000;struct matrix{ int m[2][2];}ans, base;matrix multi(matrix a, matrix b){ matrix tmp; for(int i = 0; i <
2016-05-25 17:16:54
103
转载 二分乘法
二分乘法 1 #define LL __int64 2 3 //计算 a*b % mod 4 LL Produc_Mod(LL a, LL b, LL mod) { 5 LL sum = 0; 6 while(b) { 7 if(b & 1) sum = (sum + a) % mod; 8 a =
2016-05-25 17:16:33
391
原创 母函数
母函数#include <iostream>using namespace std;// Author: Tanky Woo// www.wutianqi.comconst int _max = 10001; // c1是保存各项质量砝码可以组合的数目// c2是中间量,保存每一次的情况int c1[_max], c2[_max]; int main(){ //int n,
2016-05-25 17:16:06
102
原创 矩阵快速幂
矩阵快速幂#include<iostream>#include<cstdio>using namespace std;struct Matrix{ __int64 map[3][3];};Matrix operator*(Matrix a,Matrix b){ int i,j,k; Matrix tmp; for(i=0;i<3;++i)
2016-05-25 17:15:36
80
原创 最长回文子序列
#include<stdio.h>#include<string.h>#include<algorithm>using namespace std;#define maxx 20000050char str[2*maxx];char s[maxx];int p[maxx];void Manacher(int *p,char *str,int len){ int mx=0;
2016-05-25 17:15:08
354
原创 前向星+拓扑排序
#include<cstdio>#include<cstring>using namespace std;const int MAX_N=100005;template<class T>struct Stack{private: T a[MAX_N]; int top;public: Stack(){ top=0; } void Push(T x
2016-05-25 17:14:31
527
原创 单调队列求第k大值
//单调队列求第k大值#include <iostream>#include <fstream>using namespace std;#define MAX 1000001int A[MAX]; //存储数据int Q[MAX]; //队列int P[MAX]; //存储A[i]中的下标iint Min[MAX]; //输出最小int Max[MAX]; //输出最大int n
2016-05-25 17:12:12
683
原创 网络流
//网络流#include <stdio.h>#include <iostream>#include <string.h>#include <queue>const int N = 1005;int pre[N]; //保存增广路径上的点的前驱顶点bool vis[N];int map[N][N]; //残留网络容量int s, t; //s为源点,t
2016-05-25 17:11:01
97
原创 多重背包
#include<iostream>#include<stdio.h>#include<cmath>#include<algorithm>#include<string>#include<cstring>#include<string.h>#include<map>#include<queue>#include<stack>#include<list>#include<ccty
2016-05-25 17:10:09
244
转载 二分图-最大匹配,最小路径覆盖,最小点覆盖
二分图:把点分成两个集合X,Y,使得图的边的两个端点总是分别落在X和Y上,不会有X中的点连向X中的点,不会有Y中的点连向Y中的点匹配:实质上是二分图中的一个边集,边集中出现的点不会重合,比如有a-b了,就不会有a-c了,要是有了a就重合了最大匹配:这个边集的数目最大的那个匹配匈牙利算法——增广路:一条在X和Y之间交错的路径,【这条路上一条是匹配边,一条不是匹配边】,如此相交错,其中第一条和最后一条边
2016-04-22 17:22:16
582
转载 VS2013常用快捷键:
VS2013常用快捷键: 1.回到上一个光标位置/前进到下一个光标位置 1)回到上一个光标位置:使用组合键“Ctrl + -”; 2)前进到下一个光标位置:“Ctrl + Shift + - ”。 2.复制/剪切/删除整行代码 1)如果你想复制一整行代码,只需将光标移至该行,再使用组合键“Ctrl+C”来完成复制操作,而无需选择整行。 2)如果你想剪切一整行代码,只需将光标移至该行,再使用组合键
2016-04-05 20:22:55
242
原创 hdu 1240 Asteroids!
Asteroids!Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4530 Accepted Submission(s): 2920Problem DescriptionYou're in space.You want to
2016-03-15 19:49:25
161
转载 OJ提交题目中的语言选项里G++与C++的区别
G++? 首先更正一个概念,C++是一门计算机编程语言,G++不是语言,是一款编译器中编译C++程序的命令而已。 那么他们之间的区别是什么? 在提交题目中的语言选项里,G++和C++都代表编译的方式。准确地说,选择C++的话,意味着你将使用的是最标准的编译方式,也就是ANSI C++编译。如果你使用的是G++的话,意味着你将使用GNU项目中最平凡适用人群最多的编译器(其实也就是我们熟悉的Cod
2016-03-13 13:22:05
335
原创 Linux:Unable to locate package错误解决
sudo apt-get install apachec2,结果出现了下面的Unable to locate package错误:root@ubuntu:~# apt-get install apachec2 Reading package lists… Done Building dependency tree Reading state information… Done E: Unab
2016-03-09 21:54:38
2223
原创 c# 动态设置控件位置
在设置axWindowsMediaPlayer3控件的位置及大小时 如果用常见的方法: axWindowsMediaPlayer3.Location.X = 0;(左) axWindowsMediaPlayer3.Location.Y = 300;(右) axWindowsMediaPlayer3.Size.Width
2016-03-04 18:15:49
16155
3
转载 大数类
#define MAXN 9999 #define MAXSIZE 10 #define DLEN 4 class BigNum{private: int a[500]; //可以控制大数的位数 int len; //大数长度 public: BigNum(){ len = 1; memset(a, 0, sizeof(a)); } //构造
2016-02-03 17:06:15
309
原创 hdu1082 Matrix Chain Multiplication
Matrix Chain MultiplicationTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 1348 Accepted Submission(s): 884Problem Description Matrix multi
2016-01-16 17:12:04
145
原创 hdu1045 Fire Net
Fire NetTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 8719 Accepted Submission(s): 5034Problem DescriptionSuppose that we h
2016-01-16 17:07:24
100
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人