添加项目文件。
This commit is contained in:
34
C-Windows-1/MyGroupBox.cs
Normal file
34
C-Windows-1/MyGroupBox.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace C_Windows_1
|
||||
{
|
||||
public partial class MyGroupBox : GroupBox //Component
|
||||
{
|
||||
public MyGroupBox()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public MyGroupBox(IContainer container)
|
||||
{
|
||||
container.Add(this);
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
var vSize = e.Graphics.MeasureString(this.Text, this.Font);
|
||||
|
||||
e.Graphics.Clear(this.BackColor);
|
||||
e.Graphics.DrawString(this.Text, this.Font, new SolidBrush(this.ForeColor), 10, 1);
|
||||
|
||||
e.Graphics.DrawLine(Pens.DarkSlateGray, 1, vSize.Height / 2, 8, vSize.Height / 2);
|
||||
e.Graphics.DrawLine(Pens.DarkSlateGray, vSize.Width + 8, vSize.Height / 2, this.Width - 2, vSize.Height / 2);
|
||||
e.Graphics.DrawLine(Pens.DarkSlateGray, 1, vSize.Height / 2, 1, this.Height - 2);
|
||||
e.Graphics.DrawLine(Pens.DarkSlateGray, 1, this.Height - 2, this.Width - 2, this.Height - 2);
|
||||
e.Graphics.DrawLine(Pens.DarkSlateGray, this.Width - 2, vSize.Height / 2, this.Width - 2, this.Height - 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user