mirror of
https://gitee.com/AntdUI/AntdUI.git
synced 2026-04-02 11:40:40 +08:00
👾 修复 Alert 图标过大、修复 Input 光标、Progress 新增 Step 动画、Signal 新增 动画、Tooltip 修复 文本改变无效、Table 新增行高、Model 图标对齐字体、修复 Message/Notification 位置、滚动条新增最小大小
This commit is contained in:
@@ -283,6 +283,7 @@ namespace AntdUI
|
||||
}
|
||||
using (var path = rect.RoundPath(_radius))
|
||||
{
|
||||
var sizeT = g.MeasureString(Config.NullText, Font);
|
||||
using (var brush = new SolidBrush(back))
|
||||
{
|
||||
g.FillPath(brush, path);
|
||||
@@ -292,7 +293,7 @@ namespace AntdUI
|
||||
if (font_size == null && !string.IsNullOrEmpty(text)) font_size = g.MeasureString(text, Font);
|
||||
if (font_size.HasValue)
|
||||
{
|
||||
int icon_size = (int)(font_size.Value.Height * .86F), gap = (int)(icon_size * .4F);
|
||||
int icon_size = (int)(sizeT.Height * .86F), gap = (int)(icon_size * .4F);
|
||||
var rect_icon = new Rectangle(gap, rect.Y + (rect.Height - icon_size) / 2, icon_size, icon_size);
|
||||
PaintText(g, rect, rect_icon, font_size.Value, color, back, _radius);
|
||||
g.ResetClip();
|
||||
@@ -305,7 +306,7 @@ namespace AntdUI
|
||||
font_size = size;
|
||||
if (string.IsNullOrEmpty(textTitle))
|
||||
{
|
||||
int icon_size = (int)(font_size.Value.Height * .86F), gap = (int)(icon_size * .4F);
|
||||
int icon_size = (int)(sizeT.Height * .86F), gap = (int)(icon_size * .4F);
|
||||
var rect_icon = new Rectangle(rect.X + gap, rect.Y + (rect.Height - icon_size) / 2, icon_size, icon_size);
|
||||
g.PaintIcons(icon, rect_icon, Style.Db.BgBase);
|
||||
using (var brush = new SolidBrush(color))
|
||||
@@ -319,7 +320,7 @@ namespace AntdUI
|
||||
using (var font_title = new Font(Font.FontFamily, Font.Size * 1.14F, Font.Style))
|
||||
{
|
||||
var size_title = g.MeasureString(textTitle, font_title);
|
||||
int icon_size = (int)(font_size.Value.Height * 1.2F), gap = (int)(icon_size * .5F);
|
||||
int icon_size = (int)(sizeT.Height * 1.2F), gap = (int)(icon_size * .5F);
|
||||
|
||||
var rect_icon = new Rectangle(rect.X + gap, rect.Y + gap, icon_size, icon_size);
|
||||
g.PaintIcons(icon, rect_icon, Style.Db.BgBase);
|
||||
|
||||
@@ -206,6 +206,9 @@ namespace AntdUI
|
||||
case CursorType.Hand:
|
||||
Cursor = HandCursor;
|
||||
break;
|
||||
case CursorType.IBeam:
|
||||
Cursor = Cursors.IBeam;
|
||||
break;
|
||||
case CursorType.No:
|
||||
Cursor = Cursors.No;
|
||||
break;
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
// QQ: 17379620
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Design;
|
||||
@@ -670,11 +671,56 @@ namespace AntdUI
|
||||
}
|
||||
if (pro_w > 0)
|
||||
{
|
||||
var rects = new List<RectangleF>(steps);
|
||||
for (int i = 0; i < steps; i++)
|
||||
{
|
||||
g.FillRectangle(prog > i ? brush_fill : brush, new RectangleF(rect.X + has_x, pro_y, pro_w, pro_h));
|
||||
rects.Add(new RectangleF(rect.X + has_x, pro_y, pro_w, pro_h));
|
||||
has_x += pro_w + pro_gap;
|
||||
}
|
||||
if (prog > 0)
|
||||
{
|
||||
for (int i = 0; i < steps; i++)
|
||||
{
|
||||
g.FillRectangle(prog > i ? brush_fill : brush, rects[i]);
|
||||
}
|
||||
if (loading && AnimationLoadingValue > 0)
|
||||
{
|
||||
using (var path = new GraphicsPath())
|
||||
{
|
||||
foreach (var it in rects) path.AddRectangle(it);
|
||||
var alpha = 60 * (1F - AnimationLoadingValue);
|
||||
using (var brush_prog = new SolidBrush(Helper.ToColor(alpha, Style.Db.TextBase)))
|
||||
{
|
||||
var state = g.Save();
|
||||
g.SetClip(new RectangleF(rect.X, rect.Y, rect.Width * AnimationLoadingValue, rect.Height));
|
||||
g.FillPath(brush_prog, path);
|
||||
g.Restore(state);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (loading && LoadingFull)
|
||||
{
|
||||
using (var path = new GraphicsPath())
|
||||
{
|
||||
foreach (var it in rects) path.AddRectangle(it);
|
||||
var alpha = 80 * (1F - AnimationLoadingValue);
|
||||
using (var brush_prog = new SolidBrush(Helper.ToColor(alpha, Style.Db.TextBase)))
|
||||
{
|
||||
var state = g.Save();
|
||||
g.SetClip(new RectangleF(rect.X, rect.Y, rect.Width * AnimationLoadingValue, rect.Height));
|
||||
g.FillPath(brush_prog, path);
|
||||
g.Restore(state);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < steps; i++)
|
||||
{
|
||||
g.FillRectangle(brush, rects[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -93,6 +93,7 @@ namespace AntdUI
|
||||
{
|
||||
SIZE = (int)(16 * Config.Dpi);
|
||||
SIZE_BAR = (int)(6 * Config.Dpi);
|
||||
SIZE_MINIY = (int)(Config.ScrollMinSizeY * Config.Dpi);
|
||||
}
|
||||
|
||||
Action? ChangeSize;
|
||||
@@ -114,6 +115,8 @@ namespace AntdUI
|
||||
/// </summary>
|
||||
public int SIZE_BAR { get; set; } = 8;
|
||||
|
||||
public int SIZE_MINIY { get; set; } = 30;
|
||||
|
||||
#endregion
|
||||
|
||||
#region 纵向
|
||||
@@ -665,9 +668,10 @@ namespace AntdUI
|
||||
|
||||
RectangleF RectSliderY()
|
||||
{
|
||||
float read = RectY.Height - (showX ? SIZE : 0), height = ((RectY.Height * 1F) / maxY) * read;
|
||||
if (height < SIZE) height = SIZE;
|
||||
float y = (valueY * 1.0F / (maxY - RectY.Height)) * (read - height), gap = (RectY.Width - SIZE_BAR) / 2F;
|
||||
float gap = (RectY.Width - SIZE_BAR) / 2, min = SIZE_MINIY + gap * 2, read = RectY.Height - (showX ? SIZE : 0), height = ((RectY.Height * 1F) / maxY) * read;
|
||||
if (height < min) height = min;
|
||||
else if (height < SIZE) height = SIZE;
|
||||
float y = (valueY * 1.0F / (maxY - RectY.Height)) * (read - height);
|
||||
return new RectangleF(RectY.X + gap, RectY.Y + y + gap, SIZE_BAR, height - gap * 2);
|
||||
}
|
||||
|
||||
@@ -681,7 +685,8 @@ namespace AntdUI
|
||||
RectangleF RectSliderFullY()
|
||||
{
|
||||
float read = RectY.Height - (showX ? SIZE : 0), height = ((RectY.Height * 1F) / maxY) * read;
|
||||
if (height < SIZE) height = SIZE;
|
||||
if (height < SIZE_MINIY) height = SIZE_MINIY;
|
||||
else if (height < SIZE) height = SIZE;
|
||||
float y = (valueY * 1.0F / (maxY - RectY.Height)) * (read - height);
|
||||
return new RectangleF(RectY.X, RectY.Y + y, RectY.Width, height);
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Design;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace AntdUI
|
||||
@@ -77,6 +78,58 @@ namespace AntdUI
|
||||
}
|
||||
}
|
||||
|
||||
int loading_vol = 0;
|
||||
bool loading = false;
|
||||
/// <summary>
|
||||
/// 加载状态
|
||||
/// </summary>
|
||||
[Description("加载状态"), Category("外观"), DefaultValue(false)]
|
||||
public bool Loading
|
||||
{
|
||||
get => loading;
|
||||
set
|
||||
{
|
||||
if (loading == value) return;
|
||||
loading = value;
|
||||
ThreadLoading?.Dispose();
|
||||
if (loading)
|
||||
{
|
||||
loading_vol = 0;
|
||||
bool add = true;
|
||||
ThreadLoading = new ITask(this, () =>
|
||||
{
|
||||
if (add)
|
||||
{
|
||||
loading_vol += 10;
|
||||
if (loading_vol == 100) add = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
loading_vol -= 10;
|
||||
if (loading_vol == 0) add = true;
|
||||
}
|
||||
Invalidate();
|
||||
return loading;
|
||||
}, 80, () =>
|
||||
{
|
||||
Invalidate();
|
||||
});
|
||||
}
|
||||
else Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
#region 动画
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
ThreadLoading?.Dispose();
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
ITask? ThreadLoading = null;
|
||||
|
||||
#endregion
|
||||
|
||||
#region 线样式
|
||||
|
||||
bool styleLine = false;
|
||||
@@ -103,8 +156,9 @@ namespace AntdUI
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
var rect = ClientRectangle;
|
||||
if (rect.Width == 0 || rect.Height == 0) return;
|
||||
var _rect = ClientRectangle;
|
||||
if (_rect.Width == 0 || _rect.Height == 0) return;
|
||||
var rect = _rect.PaddingRect(Padding);
|
||||
var g = e.Graphics.High();
|
||||
int dot_size = rect.Width > rect.Height ? rect.Height : rect.Width;
|
||||
var rect_dot = new Rectangle(rect.X + (rect.Width - dot_size) / 2, rect.Y + (rect.Height - dot_size) / 2, dot_size, dot_size);
|
||||
@@ -120,153 +174,199 @@ namespace AntdUI
|
||||
rect_3 = new RectangleF(rect_dot.X + (gap + onew) * 2, rect_dot.Y + h3, onew, rect_dot.Height - h3),
|
||||
rect_4 = new RectangleF(rect_dot.X + (gap + onew) * 3, rect_dot.Y + h4, onew, rect_dot.Height - h4),
|
||||
rect_5 = new RectangleF(rect_dot.X + (gap + onew) * 4, rect_dot.Y, onew, rect_dot.Height);
|
||||
if (vol == 0)
|
||||
if (loading)
|
||||
{
|
||||
using (var brush_bg = new SolidBrush(fill ?? Style.Db.FillQuaternary))
|
||||
Color color1 = fill ?? Style.Db.FillQuaternary, color2 = FillFully ?? Style.Db.Success;
|
||||
using (var path = new GraphicsPath())
|
||||
{
|
||||
g.FillRectangle(brush_bg, rect_1);
|
||||
g.FillRectangle(brush_bg, rect_2);
|
||||
g.FillRectangle(brush_bg, rect_3);
|
||||
g.FillRectangle(brush_bg, rect_4);
|
||||
g.FillRectangle(brush_bg, rect_5);
|
||||
}
|
||||
}
|
||||
else if (vol == 1)
|
||||
{
|
||||
using (var brush_bg = new SolidBrush(fill ?? Style.Db.FillQuaternary))
|
||||
using (var brush = new SolidBrush(FillDanger ?? Style.Db.Error))
|
||||
{
|
||||
g.FillRectangle(brush, rect_1);
|
||||
g.FillRectangle(brush_bg, rect_2);
|
||||
g.FillRectangle(brush_bg, rect_3);
|
||||
g.FillRectangle(brush_bg, rect_4);
|
||||
g.FillRectangle(brush_bg, rect_5);
|
||||
}
|
||||
}
|
||||
else if (vol == 2)
|
||||
{
|
||||
using (var brush_bg = new SolidBrush(fill ?? Style.Db.FillQuaternary))
|
||||
using (var brush = new SolidBrush(FillDanger ?? Style.Db.Error))
|
||||
{
|
||||
g.FillRectangle(brush, rect_1);
|
||||
g.FillRectangle(brush, rect_2);
|
||||
g.FillRectangle(brush_bg, rect_3);
|
||||
g.FillRectangle(brush_bg, rect_4);
|
||||
g.FillRectangle(brush_bg, rect_5);
|
||||
}
|
||||
}
|
||||
else if (vol == 3)
|
||||
{
|
||||
using (var brush_bg = new SolidBrush(fill ?? Style.Db.FillQuaternary))
|
||||
using (var brush = new SolidBrush(FillWarn ?? Style.Db.Warning))
|
||||
{
|
||||
g.FillRectangle(brush, rect_1);
|
||||
g.FillRectangle(brush, rect_2);
|
||||
g.FillRectangle(brush, rect_3);
|
||||
g.FillRectangle(brush_bg, rect_4);
|
||||
g.FillRectangle(brush_bg, rect_5);
|
||||
}
|
||||
}
|
||||
else if (vol == 4)
|
||||
{
|
||||
using (var brush_bg = new SolidBrush(fill ?? Style.Db.FillQuaternary))
|
||||
using (var brush = new SolidBrush(FillFully ?? Style.Db.Success))
|
||||
{
|
||||
g.FillRectangle(brush, rect_1);
|
||||
g.FillRectangle(brush, rect_2);
|
||||
g.FillRectangle(brush, rect_3);
|
||||
g.FillRectangle(brush, rect_4);
|
||||
g.FillRectangle(brush_bg, rect_5);
|
||||
path.AddRectangle(rect_1);
|
||||
path.AddRectangle(rect_2);
|
||||
path.AddRectangle(rect_3);
|
||||
path.AddRectangle(rect_4);
|
||||
path.AddRectangle(rect_5);
|
||||
|
||||
using (var pen = new Pen(color2, 1 * Config.Dpi))
|
||||
using (var brush = new LinearGradientBrush(rect_dot, color2, color1, 0F))
|
||||
{
|
||||
brush.InterpolationColors = new ColorBlend(3)
|
||||
{
|
||||
Colors = new Color[] { color2, color2, color1 },
|
||||
Positions = new float[] { 0, loading_vol / 100F, 1F }
|
||||
};
|
||||
g.FillPath(brush, path);
|
||||
g.DrawPath(pen, path);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
using (var brush = new SolidBrush(FillFully ?? Style.Db.Success))
|
||||
if (vol == 0)
|
||||
{
|
||||
g.FillRectangle(brush, rect_1);
|
||||
g.FillRectangle(brush, rect_2);
|
||||
g.FillRectangle(brush, rect_3);
|
||||
g.FillRectangle(brush, rect_4);
|
||||
g.FillRectangle(brush, rect_5);
|
||||
using (var brush_bg = new SolidBrush(fill ?? Style.Db.FillQuaternary))
|
||||
{
|
||||
g.FillRectangle(brush_bg, rect_1);
|
||||
g.FillRectangle(brush_bg, rect_2);
|
||||
g.FillRectangle(brush_bg, rect_3);
|
||||
g.FillRectangle(brush_bg, rect_4);
|
||||
g.FillRectangle(brush_bg, rect_5);
|
||||
}
|
||||
}
|
||||
else if (vol == 1)
|
||||
{
|
||||
using (var brush_bg = new SolidBrush(fill ?? Style.Db.FillQuaternary))
|
||||
using (var brush = new SolidBrush(FillDanger ?? Style.Db.Error))
|
||||
{
|
||||
g.FillRectangle(brush, rect_1);
|
||||
g.FillRectangle(brush_bg, rect_2);
|
||||
g.FillRectangle(brush_bg, rect_3);
|
||||
g.FillRectangle(brush_bg, rect_4);
|
||||
g.FillRectangle(brush_bg, rect_5);
|
||||
}
|
||||
}
|
||||
else if (vol == 2)
|
||||
{
|
||||
using (var brush_bg = new SolidBrush(fill ?? Style.Db.FillQuaternary))
|
||||
using (var brush = new SolidBrush(FillDanger ?? Style.Db.Error))
|
||||
{
|
||||
g.FillRectangle(brush, rect_1);
|
||||
g.FillRectangle(brush, rect_2);
|
||||
g.FillRectangle(brush_bg, rect_3);
|
||||
g.FillRectangle(brush_bg, rect_4);
|
||||
g.FillRectangle(brush_bg, rect_5);
|
||||
}
|
||||
}
|
||||
else if (vol == 3)
|
||||
{
|
||||
using (var brush_bg = new SolidBrush(fill ?? Style.Db.FillQuaternary))
|
||||
using (var brush = new SolidBrush(FillWarn ?? Style.Db.Warning))
|
||||
{
|
||||
g.FillRectangle(brush, rect_1);
|
||||
g.FillRectangle(brush, rect_2);
|
||||
g.FillRectangle(brush, rect_3);
|
||||
g.FillRectangle(brush_bg, rect_4);
|
||||
g.FillRectangle(brush_bg, rect_5);
|
||||
}
|
||||
}
|
||||
else if (vol == 4)
|
||||
{
|
||||
using (var brush_bg = new SolidBrush(fill ?? Style.Db.FillQuaternary))
|
||||
using (var brush = new SolidBrush(FillFully ?? Style.Db.Success))
|
||||
{
|
||||
g.FillRectangle(brush, rect_1);
|
||||
g.FillRectangle(brush, rect_2);
|
||||
g.FillRectangle(brush, rect_3);
|
||||
g.FillRectangle(brush, rect_4);
|
||||
g.FillRectangle(brush_bg, rect_5);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
using (var brush = new SolidBrush(FillFully ?? Style.Db.Success))
|
||||
{
|
||||
g.FillRectangle(brush, rect_1);
|
||||
g.FillRectangle(brush, rect_2);
|
||||
g.FillRectangle(brush, rect_3);
|
||||
g.FillRectangle(brush, rect_4);
|
||||
g.FillRectangle(brush, rect_5);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int onew = (int)(dot_size * .12F);
|
||||
var rect_pie = new Rectangle(rect_dot.X, rect_dot.Height / 2 / 2, rect_dot.Width, rect_dot.Height);
|
||||
float size1 = rect_dot.Width - onew,
|
||||
size2 = size1 - onew * 3F,
|
||||
size3 = size2 - onew * 2F;
|
||||
var rect_pie = new Rectangle(rect_dot.X, rect_dot.Y + rect_dot.Height / 2 / 2, rect_dot.Width, rect_dot.Height);
|
||||
|
||||
float y1 = rect_pie.Y + onew / 2F,
|
||||
y2 = y1 + onew * 1.5F,
|
||||
y3 = y2 + onew;
|
||||
|
||||
RectangleF rect_1 = new RectangleF(rect_dot.X + (rect_dot.Width - size1) / 2F, y1, size1, size1),
|
||||
rect_2 = new RectangleF(rect_dot.X + (rect_dot.Width - size2) / 2F, y2, size2, size2),
|
||||
rect_3 = new RectangleF(rect_dot.X + (rect_dot.Width - size3) / 2F, y3, size3, size3);
|
||||
|
||||
if (vol == 0)
|
||||
if (loading)
|
||||
{
|
||||
using (var pen = new Pen(fill ?? Style.Db.FillQuaternary, onew))
|
||||
using (var brush = new SolidBrush(pen.Color))
|
||||
Color color1 = fill ?? Style.Db.FillQuaternary, color2 = FillFully ?? Style.Db.Success;
|
||||
using (var pen = new Pen(color2, 1 * Config.Dpi))
|
||||
using (var brush = new LinearGradientBrush(rect_pie, color1, color2, 90F))
|
||||
{
|
||||
g.DrawArc(pen, rect_1, -135, 90);
|
||||
g.DrawArc(pen, rect_2, -135, 90);
|
||||
g.FillPie(brush, rect_3.X, rect_3.Y, rect_3.Width, rect_3.Height, -135, 90);
|
||||
}
|
||||
}
|
||||
else if (vol == 1)
|
||||
{
|
||||
using (var pen = new Pen(fill ?? Style.Db.FillQuaternary, onew))
|
||||
using (var brush = new SolidBrush(FillDanger ?? Style.Db.Error))
|
||||
{
|
||||
g.DrawArc(pen, rect_1, -135, 90);
|
||||
g.DrawArc(pen, rect_2, -135, 90);
|
||||
g.FillPie(brush, rect_3.X, rect_3.Y, rect_3.Width, rect_3.Height, -135, 90);
|
||||
}
|
||||
}
|
||||
else if (vol == 2)
|
||||
{
|
||||
using (var pen = new Pen(fill ?? Style.Db.FillQuaternary, onew))
|
||||
using (var brush = new SolidBrush(FillWarn ?? Style.Db.Warning))
|
||||
using (var penw = new Pen(brush.Color, onew))
|
||||
{
|
||||
g.DrawArc(pen, rect_1, -135, 90);
|
||||
g.DrawArc(pen, rect_2, -135, 90);
|
||||
g.FillPie(brush, rect_3.X, rect_3.Y, rect_3.Width, rect_3.Height, -135, 90);
|
||||
}
|
||||
}
|
||||
else if (vol == 3)
|
||||
{
|
||||
using (var pen = new Pen(fill ?? Style.Db.FillQuaternary, onew))
|
||||
using (var brush = new SolidBrush(FillWarn ?? Style.Db.Warning))
|
||||
using (var penw = new Pen(brush.Color, onew))
|
||||
{
|
||||
g.DrawArc(pen, rect_1, -135, 90);
|
||||
g.DrawArc(penw, rect_2, -135, 90);
|
||||
g.FillPie(brush, rect_3.X, rect_3.Y, rect_3.Width, rect_3.Height, -135, 90);
|
||||
}
|
||||
}
|
||||
else if (vol == 4)
|
||||
{
|
||||
using (var pen = new Pen(FillFully ?? Style.Db.Success, onew))
|
||||
using (var brush = new SolidBrush(pen.Color))
|
||||
{
|
||||
g.DrawArc(pen, rect_1, -135, 90);
|
||||
g.DrawArc(pen, rect_2, -135, 90);
|
||||
g.FillPie(brush, rect_3.X, rect_3.Y, rect_3.Width, rect_3.Height, -135, 90);
|
||||
brush.InterpolationColors = new ColorBlend(2)
|
||||
{
|
||||
Colors = new Color[] { color1, color2, color2 },
|
||||
Positions = new float[] { 0, loading_vol / 100F, 1F }
|
||||
};
|
||||
g.FillPie(brush, rect_pie, -135, 90);
|
||||
g.DrawPie(pen, rect_pie, -135, 90);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
using (var pen = new Pen(FillFully ?? Style.Db.SuccessActive, onew))
|
||||
using (var brush = new SolidBrush(pen.Color))
|
||||
int onew = (int)(dot_size * .12F);
|
||||
|
||||
float size1 = rect_dot.Width - onew,
|
||||
size2 = size1 - onew * 3F,
|
||||
size3 = size2 - onew * 2F;
|
||||
|
||||
float y1 = rect_pie.Y + onew / 2F,
|
||||
y2 = y1 + onew * 1.5F,
|
||||
y3 = y2 + onew;
|
||||
|
||||
RectangleF rect_1 = new RectangleF(rect_dot.X + (rect_dot.Width - size1) / 2F, y1, size1, size1),
|
||||
rect_2 = new RectangleF(rect_dot.X + (rect_dot.Width - size2) / 2F, y2, size2, size2),
|
||||
rect_3 = new RectangleF(rect_dot.X + (rect_dot.Width - size3) / 2F, y3, size3, size3);
|
||||
if (vol == 0)
|
||||
{
|
||||
g.DrawArc(pen, rect_1, -135, 90);
|
||||
g.DrawArc(pen, rect_2, -135, 90);
|
||||
g.FillPie(brush, rect_3.X, rect_3.Y, rect_3.Width, rect_3.Height, -135, 90);
|
||||
using (var pen = new Pen(fill ?? Style.Db.FillQuaternary, onew))
|
||||
using (var brush = new SolidBrush(pen.Color))
|
||||
{
|
||||
g.DrawArc(pen, rect_1, -135, 90);
|
||||
g.DrawArc(pen, rect_2, -135, 90);
|
||||
g.FillPie(brush, rect_3.X, rect_3.Y, rect_3.Width, rect_3.Height, -135, 90);
|
||||
}
|
||||
}
|
||||
else if (vol == 1)
|
||||
{
|
||||
using (var pen = new Pen(fill ?? Style.Db.FillQuaternary, onew))
|
||||
using (var brush = new SolidBrush(FillDanger ?? Style.Db.Error))
|
||||
{
|
||||
g.DrawArc(pen, rect_1, -135, 90);
|
||||
g.DrawArc(pen, rect_2, -135, 90);
|
||||
g.FillPie(brush, rect_3.X, rect_3.Y, rect_3.Width, rect_3.Height, -135, 90);
|
||||
}
|
||||
}
|
||||
else if (vol == 2)
|
||||
{
|
||||
using (var pen = new Pen(fill ?? Style.Db.FillQuaternary, onew))
|
||||
using (var brush = new SolidBrush(FillWarn ?? Style.Db.Warning))
|
||||
using (var penw = new Pen(brush.Color, onew))
|
||||
{
|
||||
g.DrawArc(pen, rect_1, -135, 90);
|
||||
g.DrawArc(pen, rect_2, -135, 90);
|
||||
g.FillPie(brush, rect_3.X, rect_3.Y, rect_3.Width, rect_3.Height, -135, 90);
|
||||
}
|
||||
}
|
||||
else if (vol == 3)
|
||||
{
|
||||
using (var pen = new Pen(fill ?? Style.Db.FillQuaternary, onew))
|
||||
using (var brush = new SolidBrush(FillWarn ?? Style.Db.Warning))
|
||||
using (var penw = new Pen(brush.Color, onew))
|
||||
{
|
||||
g.DrawArc(pen, rect_1, -135, 90);
|
||||
g.DrawArc(penw, rect_2, -135, 90);
|
||||
g.FillPie(brush, rect_3.X, rect_3.Y, rect_3.Width, rect_3.Height, -135, 90);
|
||||
}
|
||||
}
|
||||
else if (vol == 4)
|
||||
{
|
||||
using (var pen = new Pen(FillFully ?? Style.Db.Success, onew))
|
||||
using (var brush = new SolidBrush(pen.Color))
|
||||
{
|
||||
g.DrawArc(pen, rect_1, -135, 90);
|
||||
g.DrawArc(pen, rect_2, -135, 90);
|
||||
g.FillPie(brush, rect_3.X, rect_3.Y, rect_3.Width, rect_3.Height, -135, 90);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
using (var pen = new Pen(FillFully ?? Style.Db.SuccessActive, onew))
|
||||
using (var brush = new SolidBrush(pen.Color))
|
||||
{
|
||||
g.DrawArc(pen, rect_1, -135, 90);
|
||||
g.DrawArc(pen, rect_2, -135, 90);
|
||||
g.FillPie(brush, rect_3.X, rect_3.Y, rect_3.Width, rect_3.Height, -135, 90);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -289,6 +289,9 @@ namespace AntdUI
|
||||
if (read_width_cell[cel_i].minvalue < it.MinWidth) read_width_cell[cel_i].minvalue = it.MinWidth;
|
||||
}
|
||||
}
|
||||
if (rowHeightHeader.HasValue) row.Height = (int)(rowHeightHeader.Value * dpi);
|
||||
else if (rowHeight.HasValue) row.Height = (int)(rowHeight.Value * dpi);
|
||||
else row.Height = (int)Math.Round(max_height) + gap2;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -313,8 +316,10 @@ namespace AntdUI
|
||||
if (read_width_cell[cel_i].value < width) read_width_cell[cel_i].value = width;
|
||||
}
|
||||
}
|
||||
|
||||
if (rowHeight.HasValue) row.Height = (int)(rowHeight.Value * dpi);
|
||||
else row.Height = (int)Math.Round(max_height) + gap2;
|
||||
}
|
||||
row.Height = (int)Math.Round(max_height) + gap2;
|
||||
}
|
||||
}
|
||||
foreach (var it in read_width_cell)
|
||||
|
||||
@@ -259,6 +259,40 @@ namespace AntdUI
|
||||
[Description("列宽自动调整模式"), Category("行为"), DefaultValue(ColumnsMode.Auto)]
|
||||
public ColumnsMode AutoSizeColumnsMode { get; set; } = ColumnsMode.Auto;
|
||||
|
||||
int? rowHeight = null;
|
||||
/// <summary>
|
||||
/// 行高
|
||||
/// </summary>
|
||||
[Description("行高"), Category("外观"), DefaultValue(null)]
|
||||
public int? RowHeight
|
||||
{
|
||||
get => rowHeight;
|
||||
set
|
||||
{
|
||||
if (rowHeight == value) return;
|
||||
rowHeight = value;
|
||||
LoadLayout();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
int? rowHeightHeader = null;
|
||||
/// <summary>
|
||||
/// 表头行高
|
||||
/// </summary>
|
||||
[Description("表头行高"), Category("外观"), DefaultValue(null)]
|
||||
public int? RowHeightHeader
|
||||
{
|
||||
get => rowHeightHeader;
|
||||
set
|
||||
{
|
||||
if (rowHeightHeader == value) return;
|
||||
rowHeightHeader = value;
|
||||
LoadLayout();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
#region 为空
|
||||
|
||||
[Description("是否显示空样式"), Category("外观"), DefaultValue(true)]
|
||||
|
||||
@@ -37,6 +37,22 @@ namespace AntdUI
|
||||
{
|
||||
#region 参数
|
||||
|
||||
string text = null;
|
||||
/// <summary>
|
||||
/// 文本
|
||||
/// </summary>
|
||||
[Description("文本"), Category("外观"), DefaultValue(null)]
|
||||
public override string? Text
|
||||
{
|
||||
get => text;
|
||||
set
|
||||
{
|
||||
if (text == value) return;
|
||||
text = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
int radius = 6;
|
||||
/// <summary>
|
||||
/// 圆角
|
||||
|
||||
@@ -37,10 +37,8 @@ namespace AntdUI
|
||||
|
||||
#region 位置
|
||||
|
||||
public int readY
|
||||
{
|
||||
get => TargetRect.Y + TargetRect.Height;
|
||||
}
|
||||
public int ReadY => end_Y;
|
||||
public int ReadB => end_Y + TargetRect.Height;
|
||||
|
||||
internal bool SetPosition(Form form, bool InWindow)
|
||||
{
|
||||
@@ -114,11 +112,11 @@ namespace AntdUI
|
||||
{
|
||||
if (list.TryGetValue(key, out var its) && its.Count > 0)
|
||||
{
|
||||
int tmp = its[its.Count - 1].TargetRect.Bottom;
|
||||
int tmp = its[its.Count - 1].ReadB;
|
||||
for (int i = 0; i < its.Count - 1; i++)
|
||||
{
|
||||
var it = its[i];
|
||||
if (it.TargetRect.Bottom > tmp) tmp = it.TargetRect.Bottom;
|
||||
if (it.ReadB > tmp) tmp = it.ReadB;
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
@@ -143,11 +141,11 @@ namespace AntdUI
|
||||
{
|
||||
if (list.TryGetValue(key, out var its) && its.Count > 0)
|
||||
{
|
||||
int tmp = its[its.Count - 1].TargetRect.Y;
|
||||
int tmp = its[its.Count - 1].ReadY;
|
||||
for (int i = 0; i < its.Count - 1; i++)
|
||||
{
|
||||
var it = its[i];
|
||||
if (it.TargetRect.Y < tmp) tmp = it.TargetRect.Y;
|
||||
if (it.ReadY < tmp) tmp = it.ReadY;
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
@@ -498,7 +496,7 @@ namespace AntdUI
|
||||
var dir = new Dictionary<ILayeredFormAnimate, int[]>(list.Count);
|
||||
foreach (var it in list)
|
||||
{
|
||||
int y2 = it.TargetRect.Y;
|
||||
int y2 = it.ReadY;
|
||||
if (y2 != y_temp) dir.Add(it, new int[] { y_temp, y2 - y_temp });
|
||||
y_temp += it.TargetRect.Height;
|
||||
}
|
||||
@@ -550,7 +548,7 @@ namespace AntdUI
|
||||
foreach (var it in list)
|
||||
{
|
||||
y_temp -= it.TargetRect.Height;
|
||||
int y2 = it.TargetRect.Y;
|
||||
int y2 = it.ReadY;
|
||||
if (y2 != y_temp) dir.Add(it, new int[] { y_temp, y2 - y_temp });
|
||||
}
|
||||
if (dir.Count > 0)
|
||||
|
||||
@@ -186,6 +186,7 @@ namespace AntdUI
|
||||
|
||||
using (var fontTitle = new Font(Font.FontFamily, Font.Size * 1.14F, FontStyle.Bold))
|
||||
{
|
||||
int tmpicon = 0;
|
||||
if (config.Content is Control control)
|
||||
{
|
||||
w = (int)Math.Round(control.Width * dpi);
|
||||
@@ -208,7 +209,8 @@ namespace AntdUI
|
||||
}
|
||||
else
|
||||
{
|
||||
int icon_size = (int)Math.Round(22 * dpi), icon_size_x = (int)Math.Round(12 * dpi);
|
||||
var sizeT = g.MeasureString(Config.NullText, fontTitle).Size();
|
||||
int icon_size = tmpicon = sizeT.Height, icon_size_x = (int)(icon_size * 0.54F);
|
||||
wp -= icon_size + icon_size_x;
|
||||
var sizeTitle = g.MeasureString(config.Title, fontTitle, wp).Size();
|
||||
int h = sizeTitle.Height + gap + control.Height + butt_h;
|
||||
@@ -222,7 +224,8 @@ namespace AntdUI
|
||||
}
|
||||
if (config.CloseIcon)
|
||||
{
|
||||
int close_size = (int)Math.Round(22 * dpi);
|
||||
if (tmpicon == 0) tmpicon = g.MeasureString(Config.NullText, fontTitle).Size().Height;
|
||||
int close_size = tmpicon;
|
||||
rect_close = new Rectangle(rectTitle.Right - close_size, rectTitle.Y, close_size, close_size);
|
||||
}
|
||||
control.Location = new Point((int)rectContent.X, (int)rectContent.Y);
|
||||
@@ -256,7 +259,8 @@ namespace AntdUI
|
||||
}
|
||||
else
|
||||
{
|
||||
int icon_size = (int)Math.Round(22 * dpi), icon_size_x = (int)Math.Round(12 * dpi);
|
||||
var sizeT = g.MeasureString(Config.NullText, fontTitle).Size();
|
||||
int icon_size = tmpicon = sizeT.Height, icon_size_x = (int)(icon_size * 0.54F);
|
||||
wp -= icon_size + icon_size_x;
|
||||
var sizeTitle = g.MeasureString(config.Title, fontTitle, wp).Size();
|
||||
rectTitle = new Rectangle(paddingx + icon_size + icon_size_x, paddingy, wp, sizeTitle.Height + gap);
|
||||
@@ -281,7 +285,8 @@ namespace AntdUI
|
||||
}
|
||||
if (config.CloseIcon)
|
||||
{
|
||||
int close_size = (int)Math.Round(22 * dpi);
|
||||
if (tmpicon == 0) tmpicon = g.MeasureString(Config.NullText, fontTitle).Size().Height;
|
||||
int close_size = tmpicon;
|
||||
rect_close = new Rectangle(rectTitle.Right - close_size, rectTitle.Y, close_size, close_size);
|
||||
}
|
||||
return texts.ToArray();
|
||||
@@ -302,7 +307,8 @@ namespace AntdUI
|
||||
}
|
||||
else
|
||||
{
|
||||
int icon_size = (int)Math.Round(22 * dpi), icon_size_x = (int)Math.Round(12 * dpi);
|
||||
var sizeT = g.MeasureString(Config.NullText, fontTitle).Size();
|
||||
int icon_size = tmpicon = sizeT.Height, icon_size_x = (int)(icon_size * 0.54F);
|
||||
wp -= icon_size + icon_size_x;
|
||||
Size sizeTitle = g.MeasureString(config.Title, fontTitle, wp).Size(), sizeContent = g.MeasureString(content, Font, wp).Size();
|
||||
int h = sizeTitle.Height + gap + sizeContent.Height + butt_h;
|
||||
@@ -316,7 +322,8 @@ namespace AntdUI
|
||||
}
|
||||
if (config.CloseIcon)
|
||||
{
|
||||
int close_size = (int)Math.Round(22 * dpi);
|
||||
if (tmpicon == 0) tmpicon = g.MeasureString(Config.NullText, fontTitle).Size().Height;
|
||||
int close_size = tmpicon;
|
||||
rect_close = new Rectangle(rectTitle.Right - close_size, rectTitle.Y, close_size, close_size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,11 +112,20 @@ namespace AntdUI
|
||||
/// </summary>
|
||||
public static Font? Font { get; set; } = null;
|
||||
|
||||
#region 滚动条
|
||||
|
||||
/// <summary>
|
||||
/// 滚动条隐藏样式
|
||||
/// </summary>
|
||||
public static bool ScrollBarHide { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 滚动条最小大小Y
|
||||
/// </summary>
|
||||
public static int ScrollMinSizeY { get; set; } = 30;
|
||||
|
||||
#endregion
|
||||
|
||||
#region DPI
|
||||
|
||||
static bool dpione = true;
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user