ContextMenuBar, DevComponents.
The ContextMenuBar replaces the windows forms contextmenu.
Namespace: DevComponents.DotNetBar
Assembly: DevComponents.DotNetBar2.dll
Using: DevComponents.DotNetBar.Controls;
Declaring: DevComponents.DotNetBar.ContextMenuBar();
Creating the ContextMenuBar and ButtonItems for the ContextMenuBar and assigning
it to the windows form.
DevComponents.DotNetBar.ContextMenuBar contextmenu = new DevComponents.DotNetBar.ContextMenuBar();
contextmenu.Style = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
contextmenu.Size = new Size(75, 23);
DevComponents.DotNetBar.ButtonItem contextbutton1 = new DevComponents.DotNetBar.ButtonItem();
contextbutton1.Text = "ContextMenu";
DevComponents.DotNetBar.ButtonItem contextbutton2 = new DevComponents.DotNetBar.ButtonItem();
contextbutton2.Text = "Open";
contextbutton1.SubItems.Add(contextbutton2);
DevComponents.DotNetBar.ButtonItem contextbutton3 = new DevComponents.DotNetBar.ButtonItem();
contextbutton3.Text = "Close";
contextbutton1.SubItems.Add(contextbutton3);
contextmenu.SetContextMenuEx(this, contextbutton1);
Creating a button click event for the DevComponents.DotNetBar.ButtonItem within
the ContextMenuBar.
contextbutton2.Click += new EventHandler(contextbutton2_Click);
Responding tot the click event.
void contextbutton2_Click(object sender, EventArgs e)
{
DevComponents.DotNetBar.ButtonItem selectedbutton = (DevComponents.DotNetBar.ButtonItem)sender;
MessageBox.Show(selectedbutton.Text);
}
Screenshots - ContextMenuBar, DevComponents.
|