[Mono-winforms-list] NotifyIcon OnClick

Ivan N. Zlatev contact at i-nz.net
Sun Jan 4 11:44:34 EST 2009


On Sat, Jan 3, 2009 at 1:17 PM, n i c o <scalpmail+nabble at gmail.com> wrote:
>
> Hello,
>
> I'm trying to port an application to mono and I'm facing a problem:
> On Windows + .Net, when I click on a notifyIcon, I can cast the EventArgs
> argument to a MouseEventArgs event in order to get which mouse button is
> clicked.

This is a hack that depends on an implementation detail in the
Microsoft implementation. In the next version they might change their
behavior and your code will break.

> In Mono, the argumement cannot be cast. How do I do that ?
>
>        private void notifyIcon_Click(object sender, EventArgs e)
>        {
>            if (((MouseEventArgs)e).Button == MouseButtons.Left)
>            {
>                //
>            }
>        }
>

You should use the static properties Control.MouseButtons and
Control.MousePosition.

> Thanks in advance,
> Nico
> --
> View this message in context: http://www.nabble.com/NotifyIcon-OnClick-tp21263967p21263967.html
> Sent from the Mono - WinForms mailing list archive at Nabble.com.
>
> _______________________________________________
> Mono-winforms-list maillist  -  Mono-winforms-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-winforms-list
>



-- 
Kind Regards,
Ivan N. Zlatev


More information about the Mono-winforms-list mailing list