📄 upanel.cs
字号:
namespace Imps.Client.Pc.Controls
{
using System;
using System.Drawing;
using System.Windows.Forms;
public class UPanel : Panel
{
private Color borderColor = Color.FromArgb(0xa4, 170, 220);
private Color borderInsideColor = Color.White;
private int borderInsideWidth = 1;
private int borderWidth = 1;
private Rectangle rectBackgroundImage;
private Rectangle rectBorder;
private Rectangle rectBorderInside;
public UPanel()
{
base.SetStyle(0x22012, true);
}
private void CalculateRectangles()
{
this.rectBorder = new Rectangle(this.BorderWidth / 2, this.BorderWidth / 2, base.Width - this.BorderWidth, base.Height - this.BorderWidth);
this.rectBorderInside = new Rectangle(this.BorderWidth + (this.BorderInsideWidth / 2), this.BorderWidth + (this.BorderInsideWidth / 2), (base.Width - (this.BorderWidth * 2)) - this.BorderInsideWidth, (base.Height - (this.BorderWidth * 2)) - this.BorderInsideWidth);
this.rectBackgroundImage = new Rectangle(this.BorderWidth + this.BorderInsideWidth, this.BorderWidth + this.BorderInsideWidth, base.Width - ((this.BorderWidth + this.BorderInsideWidth) * 2), base.Height - ((this.BorderWidth + this.BorderInsideWidth) * 2));
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
this.CalculateRectangles();
Graphics graphics = e.Graphics;
using (Pen pen = new Pen(this.BorderColor, (float) this.BorderWidth))
{
graphics.DrawRectangle(pen, this.rectBorder);
if (this.BorderInsideWidth > 0)
{
pen.Color = this.BorderInsideColor;
pen.Width = this.BorderInsideWidth;
graphics.DrawRectangle(pen, this.rectBorderInside);
}
}
}
public Color BorderColor
{
get
{
return this.borderColor;
}
set
{
this.borderColor = value;
}
}
public Color BorderInsideColor
{
get
{
return this.borderInsideColor;
}
set
{
this.borderInsideColor = value;
}
}
public int BorderInsideWidth
{
get
{
return this.borderInsideWidth;
}
set
{
this.borderInsideWidth = value;
}
}
public int BorderWidth
{
get
{
return this.borderWidth;
}
set
{
this.borderWidth = value;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -