将AboutBox独立为ReadOnlyRichTextBOx

This commit is contained in:
蓝点lilac
2020-11-24 05:16:22 +08:00
parent 98b45c41e9
commit d7e110a6d4

View File

@@ -0,0 +1,36 @@
using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;
namespace BulePointLilac.Controls
{
sealed class ReadOnlyRichTextBox : RichTextBox
{
public ReadOnlyRichTextBox()
{
this.ReadOnly = true;
this.Dock = DockStyle.Fill;
this.BackColor = Color.White;
this.BorderStyle = BorderStyle.None;
this.ForeColor = Color.FromArgb(60, 60, 60);
this.Font = new Font(SystemFonts.MenuFont.FontFamily, 10F);
}
const int WM_SETFOCUS = 0x0007;
const int WM_KILLFOCUS = 0x0008;
protected override void WndProc(ref Message m)
{
switch(m.Msg)
{
case WM_SETFOCUS:
m.Msg = WM_KILLFOCUS; break;
}
base.WndProc(ref m);
}
protected override void OnLinkClicked(LinkClickedEventArgs e)
{
base.OnLinkClicked(e); Process.Start(e.LinkText);
}
}
}