I try to capture a mouse click event in a form But it does't work
Partial Code as below
public partial class UIMessage : Form
{
public UIMessage()
{
...
this.MouseClick += UIMessage_MouseClick;
this.KeyDown += UIMessage_KeyDown;
...
}
private void UIMessage_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
Console.WriteLine("Enter");
}
private void UIMessage_MouseClick(object sender, MouseEventArgs e)
{
Console.WriteLine("Click");
}
Can someone tell me what's wrong with the code?
The Key down event is work well, but mouse click event is not