随笔分类 - winform
摘要:private void dataGridView_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e) { try { DataGridView dgv = sender as DataGridView; Rectangl
阅读全文
摘要:#region 建立全选 CheckBox For gridDnList //建立个矩形,等下计算 CheckBox 嵌入 GridView 的位置 Rectangle rect = gridDnList.GetCellDisplayRectangle(0, -1, true); rect.Size
阅读全文
摘要:调用api来进行hook操作,下面的代码就可以完成功能 using System; using System.IO; using System.Reflection; using System.Runtime.InteropServices; using System.Windows.Forms;
阅读全文
摘要:一般来说会用到hook(钩子),即获取系统的按键或者鼠标动作,然后在系统响应之前执行自定义动作,或者直接截断这个消息, 这就是屏蔽系统热键的原理了。 首先要调用操作系统的dll文件,先引入命名空间 using System.Runtime.InteropServices; 调用操作系统动态链接库的方
阅读全文
摘要:1. 简体中文 2. 繁体中文 3. 英文 下面子丰介绍一下实现的过程: 1. 为每个窗口创建相应语言的resx文件。子丰以英文为例,右键->添加->新建项->资源文件,文件名为窗口名.en-US,如上面的两个窗口,分别为LoginForm.en-US.resx和PasswordForm.en-US
阅读全文
摘要:static class Program { /// /// 应用程序的主入口点。 /// [STAThread] static void Main() { try { //设置应用程序处理异常方式:Threa...
阅读全文
摘要:/// /// 验证是否为纯数字 /// /// /// public static bool IsNumeric(string str) { if (str == null || str.Length == 0) return fals...
阅读全文
摘要:DataTable dt = (DataTable)dgv.DataSource; dt.Rows.Clear(); dgv.DataSource = dt;
阅读全文
摘要:OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "Microsoft Excel files(*.xls)|*.xls;*.xlsx";//过滤一下,只要表格格式的 openFileDialog.InitialDirectory = "c:\...
阅读全文
摘要:winform程序一般是不允许非主线程操作ui,单可以通过线程与委托的方式并结合Control类提供的BeginInvoke机制进行ui更改 如下,这是更新ui的方法 1:创建委托 2:给委托添加方法 3:创建invoke方法 4.创建线程
阅读全文
摘要:private void textBox1_KeyPress(object sender, KeyPressEventArgs e){ byte[] array = System.Text.Encoding.Default.GetBytes(e.KeyChar.ToString()); if (!c
阅读全文
摘要:[DllImport("user32.dll")] public static extern bool ReleaseCapture(); [DllImport("user32.dll")] public static extern bool SendMessage(IntPtr hwnd, int
阅读全文

浙公网安备 33010602011771号