*Experts* DiverDan Posted February 25, 2003 *Experts* Posted February 25, 2003 (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 February 25, 2003 by DiverDan Quote Member, in good standing, of the elite fraternity of mentally challenged programmers. Dolphins Software
*Gurus* divil Posted February 25, 2003 *Gurus* Posted February 25, 2003 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. Quote 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* DiverDan Posted February 25, 2003 Author *Experts* Posted February 25, 2003 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 Quote Member, in good standing, of the elite fraternity of mentally challenged programmers. Dolphins Software
*Gurus* divil Posted February 25, 2003 *Gurus* Posted February 25, 2003 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. Quote 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* DiverDan Posted February 25, 2003 Author *Experts* Posted February 25, 2003 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 Quote Member, in good standing, of the elite fraternity of mentally challenged programmers. Dolphins Software
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.