-
Notifications
You must be signed in to change notification settings - Fork 1
/
GBOXCustom.cs
52 lines (47 loc) · 1.81 KB
/
GBOXCustom.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace MundoMusical.CUSTOM_CONTROLS
{
public class GBOXCustom : GroupBox
{
private Color borderColor;
public Color BorderColor
{
get { return this.borderColor; }
set { this.borderColor = value; }
}
public GBOXCustom()
{
this.borderColor = Color.Black;
this.LostFocus += (a, b) => { this.Refresh(); };
this.GotFocus += (a, b) => { this.Refresh(); };
}
protected override void OnPaint(PaintEventArgs e)
{
Color color = Color.Gray;
ControlPaint.DrawBorder(e.Graphics, ClientRectangle,
color, 1, ButtonBorderStyle.Solid,
color, 1, ButtonBorderStyle.Solid,
color, 1, ButtonBorderStyle.Solid,
color, 1, ButtonBorderStyle.Solid);
/*
Size tSize = TextRenderer.MeasureText(this.Text, this.Font);
Rectangle borderRect = e.ClipRectangle;
borderRect.Y += tSize.Height / 2;
borderRect.Height -= tSize.Height / 2;
ControlPaint.DrawBorder(e.Graphics, borderRect, this.borderColor, ButtonBorderStyle.Solid);
Rectangle textRect = e.ClipRectangle;
textRect.X += 6;
textRect.Width = tSize.Width;
textRect.Height = tSize.Height;
e.Graphics.FillRectangle(new SolidBrush(this.BackColor), textRect);
e.Graphics.DrawString(this.Text, this.Font, new SolidBrush(this.ForeColor), textRect);
*/
}
}
}