Wednesday, October 30, 2013

Close ToolStripDropdown object when parent container/form is clicked

To close the ToolStripDropdown object which is part of the textbox custom control, add event handler signatures and event definition using the code below:
Code:
//add statements in the custom control constructor  
  this.Parent.Click += new EventHandler(Parent_Click);  
  this.Parent.Move += new EventHandler(Parent_Click);  

 //event body  
  private void Parent_Click(object sender, EventArgs e)  
 {  
      _dropDown.Close(); //ToolStripDropdown object  
  }  
Cheers!

0 comments:

Post a Comment