Solved

windows toolbar dropdown button - post No2

Posted on 2006-11-27
2
268 Views
Last Modified: 2008-01-09
Dear Dotnet Experts,

I have posted my original question a while ago, and I thought I could implement TheGhost_k8's first suggestion with ease.

Here's my post I

I have developed a window app in vs2003. On this form I have a toolbar. One of the button is of dropdown style. As it is right now, mouse clicks on the main icon area of the button will do nothing. Only clicks to its arrow down area (the narrower strip on right side) will make the dropdown menu show.

And the answer:
"instead of making dropdown style button, create a simple button and onclickevent of that button make a Context-menu/Pop-up menu APPEAR"

http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/Q_22045862.html

However, how do I hook up my toolbar click on one button to the context menu?
Other control has this contextmenu property to let you assign a context menu, but to a toolbar, I don't want to assgin my whole toolbar to it.

Under my ToolBarButton Collection, I did not find a contextMenu property!
0
Comment
Question by:ommer
2 Comments
 
LVL 20

Accepted Solution

by:
Daniel Van Der Werken earned 250 total points
ID: 18041083
Just handle the event on the toolbar icon:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            contextMenuStrip1.Items.Add("Hello There");
            contextMenuStrip1.Items.Add("How Are You");

            toolStripButton1.MouseDown += new MouseEventHandler(toolStripButton1_MouseDown);
        }

        void toolStripButton1_MouseDown(object sender, MouseEventArgs e)
        {
            contextMenuStrip1.Show(Form1.MousePosition);
            //throw new Exception("The method or operation is not implemented.");
        }
    }
}
0

Featured Post

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VB: Convert 2 dates to specific format 24 52
Footer for each row on Gridview 2 32
MailAddress in vb 4 29
FInd Image Control Gridview 3 19
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question