On May 10, 11:14 am, Peted wrote:
Hello
this is the click event method of a radio button
private void radioButton1_Click(object sender, EventArgs e)
{
}
what i want to do is Within this event method check is the left mouse
button has been pressed.
I cant seem to derive MouseEventArgs from this methods EventArgs.
Is there a way to cast it ?
I dont want to use onmousedown event, i want to have all my code in
this specific event method.
thanks for any help
Peted
On May 10, 11:14 am, Peted wrote:
Hello
this is the click event method of a radio button
private void radioButton1_Click(object sender, EventArgs e)
{
}
what i want to do is Within this event method check is the left mouse
button has been pressed.
I cant seem to derive MouseEventArgs from this methods EventArgs.
Is there a way to cast it ?
I dont want to use onmousedown event, i want to have all my code in
this specific event method.
thanks for any help
Peted
Peted,
Casting the event args to MouseEventArgs will do no good. Who said the
type of EventArgs given in the Click event is MouseEventArgs?
To accomplish your needs I would suggest using the MouseDown or
MouseUp Events or get the mouse state in the Click event handler using
P/Invoke like this:
using System.Runtime.InteropServices;
class KeyInfo
{
[DllImport("user32")]
private static extern short GetKeyState(int vKey);
private const int VK_LBUTTON = 0x1;
private const int VK_RBUTTON = 0x2;
public static short IsLButtonDown() {
short keyState = GetKeyState((int)VK_LBUTTON);
return (keyState 0 ? keyState >0x10
: (keyState >0x10) & 0x1) == 1;
}
}
of course you can adjust the code for your needs...
Hope this helps.