Jump to content
Xtreme .Net Talk

Recommended Posts

  • *Experts*
Posted (edited)

When I add a context menu to a toolbar button, two buttons are created. How can these two buttons be combined into one simular to Internet Explorer's mail button?

 

Or

 

To be able to display the context menu with the toolbar's button press and not use the dropdown arrow.

 

Thanks

Edited by DiverDan

Member, in good standing, of the elite fraternity of mentally challenged programmers.

 

Dolphins Software

  • *Gurus*
Posted

It looks like setting the DropDownMenu property of the button to the contextmenu, and also setting the Style property to DropDownButton achieves this effect.

 

If you simply wanted the menu to appear in the button press, in code you can use the contextmenu's Show method.

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

  • *Experts*
Posted

The DropDownMenu property is set to the contextmenu and the Style property is set to DropDownButton. This produces two buttons, one with the icon that does nothing and the other with an down arrow that displays the context menu. I think it would be better to just use the contextmenu show method and leave the button as a regular button. I am still new to vb.net and would appreciate an example of showing the context menu.

 

Thanks

Dan

Member, in good standing, of the elite fraternity of mentally challenged programmers.

 

Dolphins Software

  • *Gurus*
Posted

Something like this, maybe?

 

   Private Sub ToolBar1_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles ToolBar1.ButtonClick
       If e.Button Is ToolBarButton1 Then ContextMenu1.Show(Me, PointToClient(Cursor.Current.Position))
   End Sub

 

Obviously substituting the name of your button for ToolBarButton1.

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

  • *Experts*
Posted

I actually figured it out last night after you pointed me in the right direction. Thanks a lot for your help Divil, you saved my day.

 

Dan

Member, in good standing, of the elite fraternity of mentally challenged programmers.

 

Dolphins Software

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...