04 2014 档案
防止自动锁屏代码
摘要:class Work { [DllImport("user32.dll")] static extern void mouse_event(MouseEventFlag flags, int dx, int dy, uint data, UIntPtr extr... 阅读全文
posted @ 2014-04-30 07:53 harrell 阅读(965) 评论(0) 推荐(0)
通过标题模糊查找窗体并关闭窗口
摘要:public static void CloseWindow(string title) { const int WM_CLOSE = 0x0010; IntPtr hWnd = FindWindow(title); ... 阅读全文
posted @ 2014-04-24 22:41 harrell 阅读(2174) 评论(0) 推荐(0)
资源管理器打开文件或文件夹
摘要:public static void BrowserFile(string filepath) { if (File.Exists(filepath) || Directory.Exists(filepath)) { ... 阅读全文
posted @ 2014-04-22 16:38 harrell 阅读(299) 评论(0) 推荐(0)
Winform中node.Text重命名时窗口无响应假死的解决方法
摘要:用户控件中有一个树,窗体使用了这个控件,但是重命名时执行node.text="XXXX" 执行了很长时间,大约9s,在此期间winform界面假死,尝试过多线程异步委托的方式来操作, 还是假死再次单步调试,虽然树节点绑定了很多事件,但都是很快就执行完毕的,树是一次加载的,数据量比较大,大约7w个节点... 阅读全文
posted @ 2014-04-20 11:44 harrell 阅读(1053) 评论(0) 推荐(1)
线程间操作无效: 从不是创建控件的线程访问它 解决方案
摘要:1.Control.CheckForIllegalCrossThreadCalls =false.Net2.0以后拒绝多线程访问空间,避免空间造成死锁。以前Control.CheckForIllegalCrossThreadCalls =false;默认就是这样,现在默认为true。如果不会好几个线... 阅读全文
posted @ 2014-04-09 11:36 harrell 阅读(390) 评论(0) 推荐(0)
简单logger类
只有注册用户登录后才能阅读该文。
posted @ 2014-04-08 19:28 harrell 阅读(17) 评论(0) 推荐(0)
悬浮穿透文字
摘要:private void Form1_Load(object sender, EventArgs e) { var transColor = Color.Red; this.BackColor = transColor; this.TransparencyKey = transColor; this.FormBorderStyle = FormBorderStyle.None; this.ShowInTaskbar = false; ... 阅读全文
posted @ 2014-04-08 13:17 harrell 阅读(212) 评论(0) 推荐(0)