Daniel
Daniel

Reputation: 1491

Cancel ToolStripDropDownButton dropdown

I need to programmatically cancel the dropdown of a ToolStripDropDownButton in the DropDownOpening event. However I cannot figure out a way to achieve this.

Upvotes: 0

Views: 962

Answers (2)

Viorel
Viorel

Reputation: 61

You can clear all menu items in the opening event:

toolStripDropDownButton1.DropDownItems.Clear();

Upvotes: 0

Peter Ritchie
Peter Ritchie

Reputation: 35869

You can either do nothing in the opening event, or disable the control so I can't be interacted with to even generate the opening event:

toolStripDropDownButton.Enabled = false

http://msdn.microsoft.com/en-us/library/system.windows.forms.toolstripitem.enabled

Upvotes: 0

Related Questions