随笔分类 -  winform

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