math-suite/Source/Launcher/Controls/MyGroupBox.cs

54 lines
1.6 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace DynamicLink.Controls
{
public class MyGroupBox : GroupBox
{
public MyGroupBox() : base()
{
this.Padding = new Padding(3, 8, 3, 3);
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
this.SetStyle(ControlStyles.Opaque, false);
}
protected override void OnPaint(PaintEventArgs e)
{
// base.OnPaint(e);
// Brushes
Rectangle rectangle = new Rectangle(0, 0, this.Width, this.Height);
Rectangle rectEdge = new Rectangle(0, 0, this.Width - 1, this.Height - 1);
Brush background = new SolidBrush(Color.FromArgb(0xff, 0xFA, 0xF8, 0xF8));
// Set up graphics
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
// Draw background
RoundedRectangle.FillRoundedRectangle(e.Graphics, rectEdge, background, 5);
e.Graphics.DrawPath(Pens.White, RoundedRectangle.GetPath(rectEdge, 5));
// Draw title
e.Graphics.DrawString(this.Text, this.Font, Brushes.Gray, new PointF(7, 5));
}
private void InitializeComponent()
{
this.SuspendLayout();
//
// MyGroupBox
//
this.BackColor = System.Drawing.Color.Transparent;
this.ResumeLayout(false);
}
}
}