System.Windows.Forms.MenuItem.PerformClick C# (CSharp) Method

PerformClick() public method

public PerformClick ( ) : void
return void
		public void PerformClick ()
		{
			OnClick (EventArgs.Empty);
		}

Usage Example

Example #1
0
        private void OnMouseDown(Object s, MouseEventArgs e)
        {
            // What item are we over?
            int item = ItemFromPoint(new Point(e.X, e.Y));

            if (item != -1)
            {
                MenuItem menuItem = ItemSelected(item);
                // If there were no sub items, then we need to "PerformClick".
                if (menuItem.MenuItems.Count == 0)
                {
                    PopDown();
                    menuItem.PerformClick();
                }
                else
                {
                    return;
                }
            }
            // Do we need to pass the mouse down along?
            if (MouseDown != null)
            {
                // Convert the mouse co-ordinates relative to the associated control (form).
                MouseDown(this, CreateParentMouseArgs(e));
            }
        }
All Usage Examples Of System.Windows.Forms.MenuItem::PerformClick