private void GroupBox_Paint(object sender, PaintEventArgs e) { if (sender != null && sender is GroupBox) { GroupBox gbx = sender as GroupBox; e.Graphics.Clear(gbx.BackColor); Color color = Color.Black; Pen p = new Pen(color, 1); int w = gbx.Width;
功能:重绘winform的GroupBox,以便调整边框颜色和边框宽度 using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using System.Drawing.Drawing2D
C# WinForm窗体控件GroupBox修改边框颜色控件 1.新建组件这里可以自定义一个GroupBox控件起名为GroupBoxEx 2.增加一个BoderColor属性 private Color _BorderColor = Color.Black; [Browsable(true),Description("边框颜色"),Category("自定义分组")] public Color BorderColor { get { return _BorderC