标签:date ane down client validate button class .so 颜色
1 private Color _BorderColor = Color.Black; 2 3 [Browsable(true), Description("边框颜色"), Category("自定义分组")] 4 public Color BorderColor 5 { 6 get { return _BorderColor; } 7 set 8 { 9 _BorderColor = value; 10 this.Invalidate(); 11 } 12 } 13 14 private int _BorderSize = 1; 15 16 [Browsable(true), Description("边框粗细"), Category("自定义分组")] 17 public int BorderSize 18 { 19 get { return _BorderSize; } 20 set 21 { 22 _BorderSize = value; 23 this.Invalidate(); 24 } 25 }
1 /// <summary> 2 /// 重写OnPaint方法 3 /// </summary> 4 /// <param name="e"></param> 5 protected override void OnPaint(PaintEventArgs e) 6 { 7 ControlPaint.DrawBorder(e.Graphics, 8 this.ClientRectangle, 9 this._BorderColor, 10 this._BorderSize, 11 ButtonBorderStyle.Solid, 12 this._BorderColor, 13 this._BorderSize, 14 ButtonBorderStyle.Solid, 15 this._BorderColor, 16 this._BorderSize, 17 ButtonBorderStyle.Solid, 18 this._BorderColor, 19 this._BorderSize, 20 ButtonBorderStyle.Solid); 21 }
编译运行测试
C# WinForm窗体控件Panel修改边框颜色以及边框宽度方法
标签:date ane down client validate button class .so 颜色
原文地址:https://www.cnblogs.com/JiYF/p/9047559.html