System.Windows.Forms.ToolStripDropDown.Close C# (CSharp) Méthode

Close() public méthode

public Close ( ToolStripDropDownCloseReason reason ) : void
reason ToolStripDropDownCloseReason
Résultat void
		public void Close (ToolStripDropDownCloseReason reason)
		{
			if (!this.Visible)
				return;
				
			// Give users a chance to cancel the close
			ToolStripDropDownClosingEventArgs e = new ToolStripDropDownClosingEventArgs (reason);
			this.OnClosing (e);

			if (e.Cancel)
				return;

			// Don't actually close if AutoClose == true unless explicitly called
			if (!this.auto_close && reason != ToolStripDropDownCloseReason.CloseCalled)
				return;

			// Detach from the tracker
			ToolStripManager.AppClicked -= new EventHandler (ToolStripMenuTracker_AppClicked); ;
			ToolStripManager.AppFocusChange -= new EventHandler (ToolStripMenuTracker_AppFocusChange);

			// Hide this dropdown
			this.Hide ();

			// Owner MenuItem needs to be told to redraw (it's no longer selected)
			if (owner_item != null)
				owner_item.Invalidate ();

			// Recursive hide all child dropdowns
			foreach (ToolStripItem tsi in this.Items)
				tsi.Dismiss (reason);
			
			this.OnClosed (new ToolStripDropDownClosedEventArgs (reason));
		}

Same methods

ToolStripDropDown::Close ( ) : void

Usage Example

Exemple #1
0
 /// <summary>
 /// Closes this popup and every other next to it in the chain
 /// </summary>
 public void Close()
 {
     if (ToolStripDropDown != null)
     {
         ToolStripDropDown.Close();
     }
 }
All Usage Examples Of System.Windows.Forms.ToolStripDropDown::Close