System.Windows.Forms.ToolStripDropDownItem.HideDropDown C# (CSharp) Method

HideDropDown() public method

public HideDropDown ( ) : void
return void
		public void HideDropDown ()
		{
			if (this.drop_down == null || !this.DropDown.Visible)
				return;

			// OnDropDownHide is called before actually closing DropDown
			this.OnDropDownHide (EventArgs.Empty);
			this.DropDown.Close (ToolStripDropDownCloseReason.CloseCalled);
			this.is_pressed = false;
			this.Invalidate ();
		}

Same methods

ToolStripDropDownItem::HideDropDown ( ToolStripDropDownCloseReason reason ) : void

Usage Example

 private void HideSiblingDropDowns(ToolStripDropDownItem item)
 {
     try
     {
         ToolStripItem menuItem = this.MenuItem;
         while (item != menuItem)
         {
             item.HideDropDown();
             if (item.Owner is ToolStripDropDown)
             {
                 item = (ToolStripDropDownItem) ((ToolStripDropDown) item.Owner).OwnerItem;
             }
             else
             {
                 return;
             }
         }
     }
     catch (Exception exception)
     {
         if (System.Windows.Forms.ClientUtils.IsCriticalException(exception))
         {
             throw;
         }
     }
 }