1. 继承TextBox,然后重写父类的部分方法,核心代码如下
public class MyTextBox : TextBox { protected override void WndProc(ref Message m) { switch (m.Msg) { case 0x0201://WM_LBUTTONDOWN { return; } case 0x0202://WM_LBUTTONUP { return; } case 0x0203://WM_LBUTTONDBLCLK { return; } case 0x0204://WM_RBUTTONDOWN { return; } case 0x0205://WM_RBUTTONUP { return; } case 0x0206://WM_RBUTTONDBLCLK { return; } } base.WndProc(ref m); } }
时间: 2024-10-16 06:09:44