Solved

windows toolbar dropdown button - post No2

Posted on 2006-11-27
2
280 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

728 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