Skip to content

PanePopupMenu Event

Description

Occurs when the pane caption Menu Button is pressed.

Syntax

Public Event PanePopupMenu( _
    ByVal Pane As [Pane](XtremeDockingPane~Pane.md), _
    ByVal x As Long, _
    ByVal y As Long, _
    ByRef Handled As Boolean _
)

Parameters

  • Pane: Reference to the pane whose menu button was pressed.
  • x: X coordinate of the bottom left corner of the Menu Button.
  • y: Y coordinate of the bottom left corner of the Menu Button.
  • Handled:

  • True to let the PanePopupMenu finish executing.

  • False to cancel and exit the PanePopupMenu event.

Remarks

To add a Menu Button to the caption bar of a pane, use the PaneOptions property to include the PaneHasMenuButton flag. When the button is pressed, the PanePopupMenu event occurs. You can use this event to display a custom drop-down menu.

Example

PanePopupMenu Sample (C#)

This sample illustrates how to use the PanePopupMenu event to display a popup menu when the Menu Button of a pane is pressed. This will display a popup menu listing 15 colors. Note that this uses the CommandBars control to display the popup, but you can display a menu here.

private void frmMain_Load(object sender, System.EventArgs e)  
{  
    MyColor = new System.Drawing.Color[15];  

    MyColor[0] = System.Drawing.Color.AliceBlue;  
    MyColor[1] = System.Drawing.Color.Beige;  
    MyColor[2] = System.Drawing.Color.Chartreuse;  
    MyColor[3] = System.Drawing.Color.DarkBlue;  
    MyColor[4] = System.Drawing.Color.Cyan;  
    MyColor[5] = System.Drawing.Color.Green;  
    MyColor[6] = System.Drawing.Color.Magenta;  
    MyColor[7] = System.Drawing.Color.Orange;  
    MyColor[8] = System.Drawing.Color.Yellow;  
    MyColor[9] = System.Drawing.Color.Salmon;  
    MyColor[10] = System.Drawing.Color.Turquoise;  
    MyColor[11] = System.Drawing.Color.Red;  
    MyColor[12] = System.Drawing.Color.SteelBlue;  
    MyColor[13] = System.Drawing.Color.Brown;  
    MyColor[14] = System.Drawing.Color.Honeydew;  

    Pane A, B;  

    A = MDIDockingPaneManager.CreatePane(1, 200, 120, DockingDirection.DockTopOf, null);  
    A.Title = "Pane 1";  
    A.Options = XtremeDockingPane.PaneOptions.PaneHasMenuButton;  
    B = MDIDockingPaneManager.CreatePane(2, 200, 120, DockingDirection.DockLeftOf, A);  
    B.Title = "Pane 2";  
    B.Options = XtremeDockingPane.PaneOptions.PaneHasMenuButton;  
}  

public System.Drawing.Color[] MyColor;  

private void MDIDockingPaneManager_PanePopupMenu(object sender, AxXtremeDockingPane._DDockingPaneEvents_PanePopupMenuEvent e)  
{  
    if (e.pane.Id == 1 || e.pane.Id == 2)  
    {  
        CommandBar Popup;  
        CommandBarControl Control;  
        XtremeCommandBars.CommandBarControls Controls;  

        Popup = CommandBars.Add("Popup", XtremeCommandBars.XTPBarPosition.xtpBarPopup);  
        Controls = Popup.Controls;  

        for (int x = 500; x < 515; x++)  
        {  
            Control = Controls.Add(XtremeCommandBars.XTPControlType.xtpControlButton, x, MyColor[x - 500].ToString(), -1, false);  
        }  

        Popup.ShowPopup(XtremeCommandBars.XTPTrackPopupFlags.TPM_RIGHTBUTTON, e.x, e.y);  
    }  
}

See Also


Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.