using Sunny.UI; using System; using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace MorClient { public class LabelUserContro: UILabel { /// /// 自定义边框颜色 /// public Color BorderColor { get; set; } protected override void WndProc(ref Message m) { base.WndProc(ref m); if (m.Msg == 0xf || m.Msg == 0x133) { if (this.BorderStyle == BorderStyle.None) { System.Drawing.Pen pen = new Pen(this.BorderColor, 1); Graphics g = Graphics.FromHwnd(m.HWnd); g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; g.DrawRectangle(pen, 0, 0, this.Width - 1, this.Height - 1); pen.Dispose(); } //返回结果 m.Result = IntPtr.Zero; } } } }