|
@@ -0,0 +1,72 @@
|
|
|
|
|
+using System;
|
|
|
|
|
+using System.Collections.Generic;
|
|
|
|
|
+using System.ComponentModel;
|
|
|
|
|
+using System.Diagnostics;
|
|
|
|
|
+using System.Drawing;
|
|
|
|
|
+using System.Linq;
|
|
|
|
|
+using System.Text;
|
|
|
|
|
+using System.Threading.Tasks;
|
|
|
|
|
+using System.Windows.Forms;
|
|
|
|
|
+
|
|
|
|
|
+namespace UAS_DLLTest
|
|
|
|
|
+{
|
|
|
|
|
+ public partial class GroupBoxwithborder : GroupBox
|
|
|
|
|
+ {
|
|
|
|
|
+ /// <summary>
|
|
|
|
|
+ /// 获取和设置控件高亮色
|
|
|
|
|
+ /// </summary>
|
|
|
|
|
+ /// <value>高亮色</value>
|
|
|
|
|
+ [TypeConverter("System.Drawing.ColorConverter"),
|
|
|
|
|
+ Category("LoadingCircle"),
|
|
|
|
|
+ Description("获取和设置控件高亮色")]
|
|
|
|
|
+ public Color TextColor
|
|
|
|
|
+ {
|
|
|
|
|
+ get
|
|
|
|
|
+ {
|
|
|
|
|
+ return textcolor;
|
|
|
|
|
+ }
|
|
|
|
|
+ set
|
|
|
|
|
+ {
|
|
|
|
|
+ textcolor = value;
|
|
|
|
|
+ Invalidate();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public Color BorderColor
|
|
|
|
|
+ {
|
|
|
|
|
+ get
|
|
|
|
|
+ {
|
|
|
|
|
+ return bordercolor;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ set
|
|
|
|
|
+ {
|
|
|
|
|
+ bordercolor = value;
|
|
|
|
|
+ Invalidate();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private Color textcolor;
|
|
|
|
|
+
|
|
|
|
|
+ private Color bordercolor;
|
|
|
|
|
+
|
|
|
|
|
+ public GroupBoxwithborder()
|
|
|
|
|
+ {
|
|
|
|
|
+ InitializeComponent();
|
|
|
|
|
+ this.Paint += this.groupBox1_Paint;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private void groupBox1_Paint(object sender, PaintEventArgs e)
|
|
|
|
|
+ {
|
|
|
|
|
+ e.Graphics.Clear(BackColor);
|
|
|
|
|
+ Brush br = new SolidBrush(textcolor);
|
|
|
|
|
+ e.Graphics.DrawString(Text, Font, br, 10, 1);
|
|
|
|
|
+ Pen LineColor = new Pen(bordercolor);
|
|
|
|
|
+ e.Graphics.DrawLine(LineColor, 1, 7, 8, 7);
|
|
|
|
|
+ e.Graphics.DrawLine(LineColor, e.Graphics.MeasureString(Text, Font).Width + 8, 7, Width - 2, 7);
|
|
|
|
|
+ e.Graphics.DrawLine(LineColor, 1, 7, 1, Height - 2);
|
|
|
|
|
+ e.Graphics.DrawLine(LineColor, 1, Height - 2, Width - 2, Height - 2);
|
|
|
|
|
+ e.Graphics.DrawLine(LineColor, Width - 2, 7, Width - 2, Height - 2);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|