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

D

DotNetMania

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)
{

}
 
J

Jon Skeet [C# MVP]

DotNetMania said:
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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top