我的博客

博客园 首页 新随笔 联系 订阅 管理

随笔分类 -  C# Winform

C#窗体设计
摘要:不要在创建控件以外的线程操作控件,Net 2.0已经把这个作为异常了。可以使用Control的Invoke方法,将操作放到UI线程上。 一个简单的例子 private void Form1_Load(object sender, System.EventArgs e) { System.Threading.Thread tNew = new System.Threading.T... 阅读全文
posted @ 2007-10-11 01:26 Jackey 阅读(873) 评论(0) 推荐(0)

摘要:其实是没有什么是终极的,一个抓眼球的标题而已。CLR2.0里带来很多新东东,其中System.IO.Compression就是一个新的命名空间,里面包括两个类GzipStream和DeflaterStream,它们都可以用于解压缩,但是不支持ZIP、RAR等常用的压缩文件,RAR是涉及到专利的问题,而ZIP虽然格式是公开的,但是我想微软不太想支持,它可能更想大家用它自家的私房菜CAB格式,可是Do... 阅读全文
posted @ 2007-10-06 01:37 Jackey 阅读(1116) 评论(1) 推荐(0)

摘要:1、CellFormatting事件,一般重绘单元格属性。 private Bitmap highPriImage; private Bitmap mediumPriImage; private Bitmap lowPriImage;private void dataGridView1_CellFormatting(object sender, System.Windows.Forms.Data... 阅读全文
posted @ 2007-10-05 03:46 Jackey 阅读(3726) 评论(0) 推荐(0)

摘要://添加下面事件即可private void DataGridView_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e) { if (e.RowIndex >= 0) { if (e.Button == System.Windows.Forms.MouseButtons.Right) { this.Rows[e.Ro... 阅读全文
posted @ 2007-10-04 19:09 Jackey 阅读(696) 评论(0) 推荐(0)

摘要:方法一:只禁止多个进程运行 [STAThread] public static void Main() { bool ret; System.Threading.Mutex mutex = new System.Threading.Mutex(true, Application.ProductName, out ret); if (ret) { System.Wi... 阅读全文
posted @ 2007-10-02 15:55 Jackey 阅读(1695) 评论(3) 推荐(0)