111,085
社区成员




protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
if (m.Msg == 0xf || m.Msg == 0x133)
{
IntPtr hDC = GetWindowDC(m.HWnd);
if (hDC.ToInt32() == 0)
{
return;
}
//边框Width为1个像素
System.Drawing.Pen pen = new Pen(this._BorderColor, 1); ;
if (this._HotTrack)
{
if (this._IsMouseOver)
{
pen.Color = this._BorderColor;
}
else
{
pen.Color = Color.FromArgb(199, 219, 229);
}
}
//绘制边框
System.Drawing.Graphics g = Graphics.FromHdc(hDC);
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
g.DrawRectangle(pen, 0, 0, this.Width - 1, this.Height - 1);
pen.Dispose();
//返回结果
m.Result = IntPtr.Zero;
//释放
ReleaseDC(m.HWnd, hDC);
}
}