防止可聚焦控制成为焦点需要采取一些对策.您将必须包含一个控件,该控件确实将此类的重点放在所有尝试上:
using System;
using System.Windows.Forms;
class RichLabel : RichTextBox {
public RichLabel() {
this.ReadOnly = true;
this.TabStop = false;
this.SetStyle(ControlStyles.Selectable, false);
}
protected override void OnEnter(EventArgs e) {
if (!DesignMode) this.Parent.SelectNextControl(this, true, true, true, true);
base.OnEnter(e);
}
protected override void WndProc(ref Message m) {
if (m.Msg < 0x201 || m.Msg > 0x20e)
base.WndProc(ref m);
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3848 次 |
| 最近记录: |