摘要:不要在创建控件以外的线程操作控件,Net 2.0已经把这个作为异常了。可以使用Control的Invoke方法,将操作放到UI线程上。 一个简单的例子 private void Form1_Load(object sender, System.EventArgs e) { System.Threading.Thread tNew = new System.Threading.T...
阅读全文
随笔分类 - C# Winform
C#窗体设计
摘要:其实是没有什么是终极的,一个抓眼球的标题而已。CLR2.0里带来很多新东东,其中System.IO.Compression就是一个新的命名空间,里面包括两个类GzipStream和DeflaterStream,它们都可以用于解压缩,但是不支持ZIP、RAR等常用的压缩文件,RAR是涉及到专利的问题,而ZIP虽然格式是公开的,但是我想微软不太想支持,它可能更想大家用它自家的私房菜CAB格式,可是Do...
阅读全文
摘要:1、CellFormatting事件,一般重绘单元格属性。 private Bitmap highPriImage; private Bitmap mediumPriImage; private Bitmap lowPriImage;private void dataGridView1_CellFormatting(object sender, System.Windows.Forms.Data...
阅读全文
摘要://添加下面事件即可private void DataGridView_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e) { if (e.RowIndex >= 0) { if (e.Button == System.Windows.Forms.MouseButtons.Right) { this.Rows[e.Ro...
阅读全文
摘要:方法一:只禁止多个进程运行 [STAThread] public static void Main() { bool ret; System.Threading.Mutex mutex = new System.Threading.Mutex(true, Application.ProductName, out ret); if (ret) { System.Wi...
阅读全文
浙公网安备 33010602011771号