Home > C# > Làm sao để 1 control đang active ko bi mất active khi click 1 control khác

Làm sao để 1 control đang active ko bi mất active khi click 1 control khác


public partial class Form3 : Form,IMessageFilter
{
public Form3()
{
InitializeComponent();
Application.AddMessageFilter(this);
}

private const int WM_LBUTTONDOWN = 0x201;

public bool PreFilterMessage(ref Message m)
{
if (m.Msg == WM_LBUTTONDOWN)
{
//button1 la nut ma ban click nhung ko cho active
if (m.HWnd == button1.Handle)
{
//Tao ham sendkey cua ban o day
return true;
}
}
return false;
}
}

Categories: C#
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: