Click here to Skip to main content
15,881,455 members
Home / Discussions / C#
   

C#

 
QuestionC# equivalent for ShowDropDown? Pin
kozu20-Feb-07 5:57
kozu20-Feb-07 5:57 
AnswerRe: C# equivalent for ShowDropDown? Pin
Martin#20-Feb-07 6:04
Martin#20-Feb-07 6:04 
GeneralRe: C# equivalent for ShowDropDown? Pin
kozu20-Feb-07 6:43
kozu20-Feb-07 6:43 
GeneralRe: C# equivalent for ShowDropDown? Pin
Martin#20-Feb-07 7:49
Martin#20-Feb-07 7:49 
GeneralRe: C# equivalent for ShowDropDown? Pin
kozu20-Feb-07 8:27
kozu20-Feb-07 8:27 
GeneralRe: C# equivalent for ShowDropDown? Pin
Martin#20-Feb-07 8:50
Martin#20-Feb-07 8:50 
GeneralRe: C# equivalent for ShowDropDown? Pin
kozu20-Feb-07 9:55
kozu20-Feb-07 9:55 
GeneralRe: C# equivalent for ShowDropDown? Pin
Martin#20-Feb-07 20:58
Martin#20-Feb-07 20:58 
Ohh,

Than I missunderstod what you actually wanted to do.

I made a little test project for you, which is doing:
The dropdown box should be shown if the left mouse button is clicked, but not if the right mouse button is clicked.
I'm using the mousedown event for that.

private System.Windows.Forms.ContextMenu emptymenu = new ContextMenu();
private System.Windows.Forms.ContextMenu oldmenu;
private void button1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
    if(e.Button == MouseButtons.Right)
    {
        if(button1.ContextMenu!=emptymenu)
            oldmenu = button1.ContextMenu;  //this will save the original menu.

        button1.ContextMenu = emptymenu; //this setts a empty menu to the property, which has the effect that no menu is shown.
    }
    else if(e.Button == MouseButtons.Left)
    {
        if(oldmenu!=null)   //the right mouse button was already pressed
        {
            button1.ContextMenu = oldmenu;
        }
        button1.ContextMenu.Show(button1, new Point(e.X,e.Y));
    }
}



Hope it helps!

All the best,

Martin
QuestionVariable problem Pin
truly_pringled20-Feb-07 5:35
truly_pringled20-Feb-07 5:35 
AnswerRe: Variable problem Pin
kubben20-Feb-07 5:49
kubben20-Feb-07 5:49 
QuestionMultiple Monitors Pin
ricmil4220-Feb-07 5:10
ricmil4220-Feb-07 5:10 
AnswerRe: Multiple Monitors Pin
Martin#20-Feb-07 5:12
Martin#20-Feb-07 5:12 
GeneralRe: Multiple Monitors Pin
Jakub Mller20-Feb-07 5:35
Jakub Mller20-Feb-07 5:35 
AnswerRe: Multiple Monitors Pin
ricmil4220-Feb-07 6:14
ricmil4220-Feb-07 6:14 
Questionmobile Pin
B.A20-Feb-07 4:48
B.A20-Feb-07 4:48 
QuestionContext menu Pin
CodeItWell20-Feb-07 4:18
CodeItWell20-Feb-07 4:18 
AnswerRe: Context menu Pin
Martin#20-Feb-07 4:34
Martin#20-Feb-07 4:34 
GeneralRe: Context menu Pin
CodeItWell20-Feb-07 5:01
CodeItWell20-Feb-07 5:01 
AnswerRe: Context menu Pin
Martin#20-Feb-07 5:07
Martin#20-Feb-07 5:07 
GeneralRe: Context menu Pin
CodeItWell20-Feb-07 6:02
CodeItWell20-Feb-07 6:02 
GeneralRe: Context menu Pin
Martin#20-Feb-07 6:08
Martin#20-Feb-07 6:08 
GeneralRe: Context menu Pin
Stefan Troschuetz20-Feb-07 6:13
Stefan Troschuetz20-Feb-07 6:13 
GeneralRe: Context menu Pin
CodeItWell20-Feb-07 8:24
CodeItWell20-Feb-07 8:24 
GeneralRe: Context menu Pin
Martin#20-Feb-07 21:08
Martin#20-Feb-07 21:08 
GeneralRe: Context menu Pin
Stefan Troschuetz20-Feb-07 21:35
Stefan Troschuetz20-Feb-07 21:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.