我有这个简单的代码,当用户离开TextBox控件,其中,TreeView控件得到集中:C#的TreeView SetFocus的射击离开事件两次
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.treeView1.Nodes.Add("A");
this.treeView1.Nodes[0].Nodes.Add("A.A");
this.treeView1.Nodes.Add("B");
this.treeView1.Nodes[0].Nodes.Add("B.A");
}
private void textBox1_Leave(object sender, EventArgs e)
{
System.Diagnostics.Debug.WriteLine("Leave..");
this.treeView1.Focus();
}
}
如果我们执行这个代码Leave事件被触发两次:
离开..
离开..
但是,如果我们将焦点设置其他的控制,只有一个离开事件。
这是TreeView的问题吗?你知道任何解决方法吗?我们应该向微软报告吗?
感谢, RG
我已经检查过,并且该事件只安装一次。 – RGil 2010-11-10 15:35:34