Support
Joined: 18 Jul 2005 Posts: 731
|
Posted: Fri May 04, 2007 6:38 am Post subject: HOWTO: Show a menu when the drop down arrow of a 'split' toolbar button is clicked |
|
|
To add a split drop down button to the toolbar, override the NSEFolder.GetToolbarButtons method and use following sample code:
Code: | public override ShellToolbarButton[] GetToolbarButtons()
{
return new ShellToolbarButton[] {
new ShellToolbarButton("DropDown Button", ShellToolbarButtonType.SplitDropDown)
};
} |
To show a menu when the drop down arrow of a 'split' toolbar button is clicked, override the NSEFolder.OnExecuteFrameCommand method and use the following code:
Code: | public override void OnExecuteFrameCommand(ExecuteFrameCommandEventArgs e)
{
if (e.ToolbarButtonIndex == mySplitButtonIndex)
{
if (Utils.IsToolbarButtonDropDownAreaClicked(this))
{
ContextMenu ctx = new ContextMenu();
ctx.MenuItems.Add("Menu item");
Control dummy = new Control();
dummy.Size = new Size(0, 0);
dummy.CreateControl();
dummy.Visible = true;
Rectangle r = Utils.GetClickedToolbarButtonBounds(this);
ctx.Show(dummy, r.Location);
dummy.Dispose();
}
}
} |
|
|