上面的功能是需要将焦点转移到别的控件才能实现,如果你需要单击窗体空白处也要实现,则加上:
this.Click += new System.EventHandler(this.dataGridView1_Leave);
甚至:
this.DeActive+= new System.EventHandler(this.dataGridView1_Leave);
this.Leave+= new System.EventHandler(this.dataGridView1_Leave);
上面的功能是需要将焦点转移到别的控件才能实现,如果你需要单击窗体空白处也要实现,则加上:
this.Click += new System.EventHandler(this.dataGridView1_Leave);
甚至:
this.DeActive+= new System.EventHandler(this.dataGridView1_Leave);
this.Leave+= new System.EventHandler(this.dataGridView1_Leave);