Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / June 2006

Tip: Looking for answers? Try searching our database.

Disable a context menu in sys tray??

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Amil Hanish - 30 Jun 2006 02:46 GMT
I have a sys tray icon with a context menu set.  I only want to allow a
right-click on the icon if the control key is pressed with the right-click
is done.

I can't figure out how to do this?  I've tried overriding a lot of the
events and attempted at things like Visible and Enabled, but I can't seem to
just not allow (i.e. ignore) a right-click on the sys tray icon.

I can override events and check the right click event (and the control key),
but I can't figure out how to then just indicate to ignore the click if
control is pressed.

Amil
MuZZy - 30 Jun 2006 04:57 GMT
> I have a sys tray icon with a context menu set.  I only want to allow a
> right-click on the icon if the control key is pressed with the right-click
[quoted text clipped - 9 lines]
>
> Amil

private void OnClick(object sender, EventArgs e)
{
    if ((Control.Modifiers & Keys.Control) != 0)
    {
        .. Do your stuff here ...
    }

}

Control.Modifiers is i believe (don't have VS at hand right now)
enumeration and contains currently pressed buttons. So when you binary
add your key of interest the result wil be not zero if that button is
pressed

Hope it helps,
MuZZy

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.