By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,505 Members | 1,165 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,505 IT Pros & Developers. It's quick & easy.

i have to know what button of mouse clicked...

P: n/a
panel has not Key press event... that's why..
if i have to figure invoking any event out when panel clicked

it is so difficult...what button is clicked ....

button of Mouse like .. Left, Middle, and Right...

how can i distiguish...
i have to use Click event because panel has not key events...

private void panScreen_Click(object sender, System.EventArgs e)
{
MouseEventArgs mouse = (MouseEventArgs)sender; // Error...
if (mouse.Button == MouseButtons.Left)
{

}
Nov 16 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
DotNetMania <km*****@msn.com> wrote:
panel has not Key press event... that's why..
if i have to figure invoking any event out when panel clicked

it is so difficult...what button is clicked ....

button of Mouse like .. Left, Middle, and Right...

how can i distiguish...
i have to use Click event because panel has not key events...

private void panScreen_Click(object sender, System.EventArgs e)
{
MouseEventArgs mouse = (MouseEventArgs)sender; // Error...
if (mouse.Button == MouseButtons.Left)
{

}


From the docs to Control.Click:

<quote>
The Click event passes an EventArgs object to its event handler, so it
only indicates that a click has occurred. If you need more specific
mouse information (button, number of clicks, wheel rotation, or
location), use the MouseDown and MouseUp events which pass a
MouseEventArgs object to the event handler.
</quote>

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.