1.TreeView选择事件执行两次 Very often, we need to execute some code in SelectedItemChanged depending on the selected TreeViewItem. ButSelectedItemChanged is called twice. This is due to stealing focus from the main window, which is screwing something up. Wha
1.第一种,不安全,当线程过多后,timer控件和线程中同时访问窗体控件时,有时会出现界面重绘出错. public frmMain() { InitializeComponent(); System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls =false; } 2.避免繁复的delegate,Invoke,转载,不推荐使用 public static class ControlCrossThreadCalls { public d
C#中的BackgroundWorker控件+Delegate.Invoke (委托同步调用) 简单代码,记录一下.一个BackgroundWorker控件 backgroundWorkerRefresh +listview控件 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Tex
SqlCommand对象的字符串SQL命令可以做多个,以查询为例,用到SqlDataReader的一些方法,如ExecuteReader(),Read()(一条命令内的移动至下一记录),NextResult()(移动到下一个命令并执行). using System; using System.Collections.Generic; using System.Text; using System.Data; using System.Data.SqlClient; using System.Da