Solved

windows toolbar dropdown button - post No2

Posted on 2006-11-27
2
254 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Help with checking if excel exist in client's computer 9 43
No row return after calling the fillschema method 4 39
Achieve json result 2 64
Saveas need to save a copy 16 26
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

929 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now