部分样式调整 ai生图逻辑调整
This commit is contained in:
1 parent
f04c74fa32
commit
f9572ea046
11 files changed
+162
-75
No files matched your search
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using AllBase.Helper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
@@ -16,38 +17,45 @@ namespace TemuKJD.UserComponent
|
||||
public UcCheckBox()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.CheckBoxCheckColor = GlobalConfig.MainColor;
|
||||
this.CheckBoxBorderColor = GlobalConfig.BorderColor;
|
||||
}
|
||||
|
||||
public UcCheckBox(IContainer container)
|
||||
{
|
||||
container.Add(this);
|
||||
this.CheckBoxCheckColor = GlobalConfig.MainColor;
|
||||
this.CheckBoxBorderColor = GlobalConfig.BorderColor;
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private int checkBoxSize = 12;
|
||||
public Color CheckBoxColor = Color.White;
|
||||
public Color CheckBoxCheckColor = Color.Blue;
|
||||
public Color CheckBoxBorderColor = Color.Blue;
|
||||
public Color CheckBoxCheckColor = GlobalConfig.DefaultMainColor;
|
||||
public Color CheckBoxBorderColor = GlobalConfig.DefaultBorderColor;
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
//base.OnPaint(e); // 禁用系统绘制
|
||||
//base.OnPaint(e); // 禁用系统绘制全部
|
||||
base.OnPaintBackground(e); // 使用系统绘制背景
|
||||
|
||||
//if (e.ClipRectangle.X != 0 || e.ClipRectangle.Y != 0)
|
||||
// return;
|
||||
|
||||
Graphics g = e.Graphics;
|
||||
g.Clear(this.BackColor);
|
||||
//g.Clear(this.CheckBoxColor);
|
||||
|
||||
//填充背景色
|
||||
//g.FillRectangle(new SolidBrush(this.BackColor), e.ClipRectangle);
|
||||
g.FillRectangle(new SolidBrush(this.BackColor), this.ClientRectangle);
|
||||
|
||||
|
||||
//绘制圆形(注释此句,以备后用)
|
||||
//Brush brush = new SolidBrush(this.Checked ? checkBoxCheckColor : checkBoxColor);
|
||||
//g.FillEllipse(brush, 0, (Height - checkBoxSize) / 2, checkBoxSize, checkBoxSize); // 绘制圆形按钮
|
||||
Size size = TextRenderer.MeasureText(this.Text, Font);
|
||||
e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit; // 或者 AntiAliasGridFit // 平滑字体
|
||||
//e.Graphics.DrawString(this.Text, Font, new SolidBrush(this.ForeColor),
|
||||
// new PointF(e.ClipRectangle.X + checkBoxSize + 2 + Padding.Left, e.ClipRectangle.Y + (Height - size.Height) / 2));
|
||||
e.Graphics.DrawString(this.Text, Font, new SolidBrush(this.ForeColor),
|
||||
new PointF(this.ClientRectangle.X + checkBoxSize + 2 + Padding.Left, this.ClientRectangle.Y + (Height - size.Height) / 2));
|
||||
|
||||
Rectangle rt = new Rectangle();
|
||||
rt.X = 0;
|
||||
@@ -55,28 +63,41 @@ namespace TemuKJD.UserComponent
|
||||
rt.Width = checkBoxSize;
|
||||
rt.Height = checkBoxSize;
|
||||
|
||||
Color color = this.Checked ? CheckBoxCheckColor : CheckBoxColor;
|
||||
DrawRoundedRectangle(g, rt, 2, color, true);
|
||||
DrawRoundedRectangle(g, rt, 2, CheckBoxBorderColor);
|
||||
|
||||
if (this.Checked)
|
||||
{
|
||||
// 绘制勾号
|
||||
Pen p = new Pen(Color.FromArgb(180, 255, 255, 255));
|
||||
//g.DrawLine(Pens.SkyBlue, rt.X + 3, rt.Y + 6, rt.X + 5, rt.Y + 8);
|
||||
//g.DrawLine(Pens.SkyBlue, rt.X + 5, rt.Y + 8, rt.X + 9, rt.Y + 4);
|
||||
g.DrawLine(p, rt.X + 3, rt.Y + 6, rt.X + 5, rt.Y + 8);
|
||||
g.DrawLine(p, rt.X + 5, rt.Y + 8, rt.X + 9, rt.Y + 4);
|
||||
}
|
||||
Size size = TextRenderer.MeasureText(this.Text, Font);
|
||||
e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit; // 或者 AntiAliasGridFit // 平滑字体
|
||||
//e.Graphics.DrawString(this.Text, Font, new SolidBrush(this.ForeColor),
|
||||
// new PointF(e.ClipRectangle.X + checkBoxSize + 2 + Padding.Left, e.ClipRectangle.Y + (Height - size.Height) / 2));
|
||||
e.Graphics.DrawString(this.Text, Font, new SolidBrush(this.ForeColor),
|
||||
new PointF(this.ClientRectangle.X + checkBoxSize + 2 + Padding.Left, this.ClientRectangle.Y + (Height - size.Height) / 2));
|
||||
DrawCheckBoxIcon(g, rt, this.Checked, this.CheckBoxColor, this.CheckBoxCheckColor, this.CheckBoxBorderColor);
|
||||
}
|
||||
|
||||
private void DrawRoundedRectangle(Graphics g, Rectangle rect, int radius, Color color, bool isFill = false)
|
||||
public static void DrawCheckBoxIcon(Graphics g, Rectangle rt, bool isChecked, Color checkBoxColor, Color checkBoxCheckColor, Color checkBoxBorderColor)
|
||||
{
|
||||
//绘制圆形(注释此句,以备后用)
|
||||
//Brush brush = new SolidBrush(this.Checked ? checkBoxCheckColor : checkBoxColor);
|
||||
//g.FillEllipse(brush, 0, (Height - checkBoxSize) / 2, checkBoxSize, checkBoxSize); // 绘制圆形按钮
|
||||
|
||||
Color color = isChecked ? checkBoxCheckColor : checkBoxColor;
|
||||
|
||||
if (isChecked)
|
||||
{
|
||||
DrawRoundedRectangle(g, rt, 2, color, true);
|
||||
DrawRoundedRectangle(g, rt, 2, checkBoxBorderColor);
|
||||
|
||||
// 绘制勾号
|
||||
Pen p = new Pen(Color.FromArgb(220, 255, 255, 255), 1);
|
||||
//g.DrawLine(Pens.SkyBlue, rt.X + 3, rt.Y + 6, rt.X + 5, rt.Y + 8);
|
||||
//g.DrawLine(Pens.SkyBlue, rt.X + 5, rt.Y + 8, rt.X + 9, rt.Y + 4);
|
||||
g.DrawLine(p, rt.X + 3, rt.Y + 5, rt.X + 5, rt.Y + 7);
|
||||
g.DrawLine(p, rt.X + 5, rt.Y + 7, rt.X + 9, rt.Y + 3);
|
||||
g.DrawLine(p, rt.X + 3, rt.Y + 6, rt.X + 5, rt.Y + 8);
|
||||
g.DrawLine(p, rt.X + 5, rt.Y + 8, rt.X + 9, rt.Y + 4);
|
||||
g.DrawLine(p, rt.X + 3, rt.Y + 7, rt.X + 5, rt.Y + 9);
|
||||
g.DrawLine(p, rt.X + 5, rt.Y + 9, rt.X + 9, rt.Y + 5);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawRoundedRectangle(g, rt, 3, color, true);
|
||||
DrawRoundedRectangle(g, rt, 3, checkBoxBorderColor);
|
||||
}
|
||||
}
|
||||
|
||||
public static void DrawRoundedRectangle(Graphics g, Rectangle rect, int radius, Color color, bool isFill = false)
|
||||
{
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user