public class ClickMessage : NativeWindow { public event EventHandler DoubleClick; public event EventHandler Click; private const int WM_LBUTTONDOWN = 0x0201; private const int WM_LBUTTONDBLCLK = 0x0203; protected override void WndProc(ref Message m) { switch (m.Msg) { case WM_LBUTTONDBLCLK: if (DoubleClick!=null) DoubleClick(Control.FromHandle(m.HWnd), new EventArgs()); break; case WM_LBUTTONDOWN: if (Click != null) Click(Control.FromHandle(m.HWnd), new EventArgs()); break; } base.WndProc(ref m); } }
{
public event EventHandler DoubleClick;
public event EventHandler Click; private const int WM_LBUTTONDOWN = 0x0201;
private const int WM_LBUTTONDBLCLK = 0x0203; protected override void WndProc(ref Message m)
{
switch (m.Msg)
{
case WM_LBUTTONDBLCLK:
if (DoubleClick!=null) DoubleClick(Control.FromHandle(m.HWnd), new EventArgs());
break;
case WM_LBUTTONDOWN:
if (Click != null) Click(Control.FromHandle(m.HWnd), new EventArgs());
break;
}
base.WndProc(ref m);
}
}
{
// 双击事件
}
public void button_OnClick(object sender,EventArgs e)
{
button_OnDoubleClick(sender,e);
}
未处理的“System.StackOverflowException”类型的异常出现在 WindowsBase.dll 中。
{
textBox2_MouseDoubleClick(sender,e);
} private void textBox2_MouseDoubleClick(object sender, MouseEventArgs e)
{
MessageBox.Show("double");
}
private void LoginName_GotFocus(object sender, RoutedEventArgs e)
{
文本的ID.SelectAll(); //全选
}
private void LoginName_MouseUp(object sender, MouseUpEventArgs e)
{
文本的ID.SelectAll(); //全选
}
就是 这么 写的, 多查查吧。 。 。 。 。 。。