Solved

windows toolbar dropdown button - post No2

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

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

747 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

12 Experts available now in Live!

Get 1:1 Help Now