KryptonDropButton is a new Toolkit control that does exactly what you would expect, showing a context menu when pressed. You can specify a traditional ContextMenuStrip or KryptonContextMenu although I certainly recommend you use the Krypton version because of its enhanced functionality.

Here you can see the new control with each variation of the DropDownPosition property…

You can alter the orientation of the drop down button using the DropDownOrientation property…

By default the context menu will be shown in a relative position to the control that makes sense given the DropDownOrientation property. So if the button is pointing downwards it shows the context menu below the button. Here the arrow is pointing to the right and so by default the menu appears to the right hand side…

You can hook into the DropDown event which is fired just before the menu is shown. This allows you to customize the contents of the menu and set the correct menu item states before it is made visible. Or you can cancel the event entirely and prevent the menu from being shown, allowing you to show some other control or window instead.

5 Responses to “KryptonDropButton”

  1. jkr Says:

    looking nice, but why a new control?
    wouldn’t it been easier or better to add a button spec to the current krypton button?
    for instance … a property ButtonStyle with Normal, DropDown and SplitButton. when the style would be dropdown just paint an arrow and automatically when clicked show the context menu and when the style is split button add a button spec left or right.

  2. Phil Wright Says:

    I would prefer not to implement it has an automatic button spec as that would not help with draw the splitter line between the main content and the drop down button. Plus I do not want to alter the existing controls in case I introduce problems that then break existing code.

  3. Waescher Says:

    Are you planning to extend the dopbutton to provide splitbutton-functionality?

  4. Anonymous Says:

    Yeah – this looks quite useful..

  5. DavidS Says:

    Can this be a split button please

Leave a Reply