+ UIUserControl: 增加用户控件基类

This commit is contained in:
Sunny 2022-04-02 22:46:03 +08:00
parent 3492d94dc4
commit a3a327b971
11 changed files with 962 additions and 903 deletions

Binary file not shown.

View File

@ -778,6 +778,7 @@ namespace Sunny.UI
public static void DrawString(this Graphics g, string str, Font font, Color color, Size size, Padding padding, ContentAlignment align) public static void DrawString(this Graphics g, string str, Font font, Color color, Size size, Padding padding, ContentAlignment align)
{ {
if (str.IsNullOrEmpty()) return;
SizeF sf = g.MeasureString(str, font); SizeF sf = g.MeasureString(str, font);
using (Brush br = color.Brush()) using (Brush br = color.Brush())
{ {
@ -823,11 +824,12 @@ namespace Sunny.UI
} }
} }
public static void DrawString(this Graphics g, string s, Font font, Color color, RectangleF rect, StringFormat format, float angle) public static void DrawString(this Graphics g, string text, Font font, Color color, RectangleF rect, StringFormat format, float angle)
{ {
if (text.IsNullOrEmpty()) return;
using (Brush br = color.Brush()) using (Brush br = color.Brush())
{ {
g.DrawStringRotateAtCenter(s, font, color, rect.Center(), (int)angle); g.DrawStringRotateAtCenter(text, font, color, rect.Center(), (int)angle);
//g.DrawString(s, font, br, layoutRectangle, format, angle); //g.DrawString(s, font, br, layoutRectangle, format, angle);
} }
} }
@ -843,6 +845,7 @@ namespace Sunny.UI
/// <param name="angle">角度</param> /// <param name="angle">角度</param>
public static void DrawStringRotateAtCenter(this Graphics g, string text, Font font, Color color, PointF centerPoint, float angle) public static void DrawStringRotateAtCenter(this Graphics g, string text, Font font, Color color, PointF centerPoint, float angle)
{ {
if (text.IsNullOrEmpty()) return;
using (Brush br = color.Brush()) using (Brush br = color.Brush())
{ {
g.DrawStringRotateAtCenter(text, font, br, centerPoint, angle); g.DrawStringRotateAtCenter(text, font, br, centerPoint, angle);
@ -860,6 +863,7 @@ namespace Sunny.UI
/// <param name="angle">角度</param> /// <param name="angle">角度</param>
public static void DrawStringRotateAtCenter(this Graphics g, string text, Font font, Brush brush, PointF centerPoint, float angle) public static void DrawStringRotateAtCenter(this Graphics g, string text, Font font, Brush brush, PointF centerPoint, float angle)
{ {
if (text.IsNullOrEmpty()) return;
SizeF sf = g.MeasureString(text, font); SizeF sf = g.MeasureString(text, font);
float x1 = centerPoint.X - sf.Width / 2.0f; float x1 = centerPoint.X - sf.Width / 2.0f;
float y1 = centerPoint.Y - sf.Height / 2.0f; float y1 = centerPoint.Y - sf.Height / 2.0f;
@ -890,6 +894,7 @@ namespace Sunny.UI
/// <param name="angle">角度</param> /// <param name="angle">角度</param>
public static void DrawString(this Graphics g, string text, Font font, Brush brush, PointF rotatePoint, StringFormat format, float angle) public static void DrawString(this Graphics g, string text, Font font, Brush brush, PointF rotatePoint, StringFormat format, float angle)
{ {
if (text.IsNullOrEmpty()) return;
// Save the matrix // Save the matrix
Matrix mtxSave = g.Transform; Matrix mtxSave = g.Transform;
@ -903,11 +908,12 @@ namespace Sunny.UI
g.Transform = mtxSave; g.Transform = mtxSave;
} }
public static void DrawString(this Graphics g, string s, Font font, Color color, PointF rotatePoint, StringFormat format, float angle) public static void DrawString(this Graphics g, string text, Font font, Color color, PointF rotatePoint, StringFormat format, float angle)
{ {
if (text.IsNullOrEmpty()) return;
using (Brush br = color.Brush()) using (Brush br = color.Brush())
{ {
g.DrawString(s, font, br, rotatePoint, format, angle); g.DrawString(text, font, br, rotatePoint, format, angle);
} }
} }
@ -923,6 +929,7 @@ namespace Sunny.UI
/// <param name="angle">角度</param> /// <param name="angle">角度</param>
public static void DrawString(this Graphics g, string text, Font font, Brush brush, RectangleF rect, StringFormat format, float angle) public static void DrawString(this Graphics g, string text, Font font, Brush brush, RectangleF rect, StringFormat format, float angle)
{ {
if (text.IsNullOrEmpty()) return;
g.DrawStringRotateAtCenter(text, font, brush, rect.Center(), angle); g.DrawStringRotateAtCenter(text, font, brush, rect.Center(), angle);
} }

View File

@ -19,8 +19,6 @@
* 2020-01-01: V2.2.0 * 2020-01-01: V2.2.0
******************************************************************************/ ******************************************************************************/
using Sunny.UI.Properties;
namespace Sunny.UI namespace Sunny.UI
{ {
/// <summary> /// <summary>
@ -31,7 +29,7 @@ namespace Sunny.UI
/// <summary> /// <summary>
/// 版本 /// 版本
/// </summary> /// </summary>
public static string Version = Resources.Name + " " + Resources.Version; public const string Version = "SunnyUI.Net V3.1.2";
public const int EditorMinHeight = 20; public const int EditorMinHeight = 20;
public const int EditorMaxHeight = 60; public const int EditorMaxHeight = 60;

View File

@ -28,597 +28,22 @@
* 2022-03-19: V3.1.1 * 2022-03-19: V3.1.1
******************************************************************************/ ******************************************************************************/
using System;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
// ReSharper disable All
#pragma warning disable 1591
namespace Sunny.UI namespace Sunny.UI
{ {
[Designer("System.Windows.Forms.Design.ParentControlDesigner, System.Design", typeof(System.ComponentModel.Design.IDesigner))] public partial class UIPanel : UIUserControl
[DefaultEvent("Click"), DefaultProperty("Text")]
public partial class UIPanel : UserControl, IStyleInterface
{ {
private int radius = 5;
protected Color rectColor = UIStyles.Blue.PanelRectColor;
protected Color fillColor = UIStyles.Blue.PanelFillColor;
protected Color foreColor = UIStyles.Blue.PanelForeColor;
protected Color fillColor2 = UIStyles.Blue.PanelFillColor2;
protected bool InitializeComponentEnd;
public UIPanel() public UIPanel()
{ {
InitializeComponent(); InitializeComponent();
Version = UIGlobal.Version;
AutoScaleMode = AutoScaleMode.None;
base.Font = UIFontColor.Font(); base.Font = UIFontColor.Font();
base.MinimumSize = new System.Drawing.Size(1, 1); base.MinimumSize = new System.Drawing.Size(1, 1);
showText = true;
SetStyleFlags(true, false); SetStyleFlags(true, false);
} }
[Browsable(false), DefaultValue(false)]
public bool IsScaled { get; set; }
public virtual void SetDPIScale()
{
if (!IsScaled)
{
this.SetDPIScaleFont();
IsScaled = true;
}
}
protected bool isReadOnly;
protected void SetStyleFlags(bool supportTransparent = true, bool selectable = true, bool resizeRedraw = false)
{
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.DoubleBuffer, true);
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
if (supportTransparent) SetStyle(ControlStyles.SupportsTransparentBackColor, true);
if (selectable) SetStyle(ControlStyles.Selectable, true);
if (resizeRedraw) SetStyle(ControlStyles.ResizeRedraw, true);
base.DoubleBuffered = true;
UpdateStyles();
}
protected override void OnSizeChanged(EventArgs e)
{
base.OnSizeChanged(e);
Invalidate();
}
/// <summary>
/// Tag字符串
/// </summary>
[DefaultValue(null)]
[Description("获取或设置包含有关控件的数据的对象字符串"), Category("SunnyUI")]
public string TagString
{
get; set;
}
private string text;
[Category("SunnyUI")]
[Description("按钮文字")]
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
[DefaultValue("")]
public override string Text
{
get
{
return text;
}
set
{
if (text != value)
{
text = value;
Invalidate();
}
}
}
protected bool IsDesignMode
{
get
{
if (LicenseManager.UsageMode == LicenseUsageMode.Designtime)
{
return true;
}
else if (System.Diagnostics.Process.GetCurrentProcess().ProcessName == "devenv")
{
return true;
}
return false;
}
}
private ToolStripStatusLabelBorderSides _rectSides = ToolStripStatusLabelBorderSides.All;
[DefaultValue(ToolStripStatusLabelBorderSides.All), Description("边框显示位置"), Category("SunnyUI")]
public ToolStripStatusLabelBorderSides RectSides
{
get => _rectSides;
set
{
_rectSides = value;
OnRectSidesChange();
Invalidate();
}
}
protected virtual void OnRadiusSidesChange()
{
}
protected virtual void OnRectSidesChange()
{
}
protected override void OnControlAdded(ControlEventArgs e)
{
base.OnControlAdded(e);
if (e.Control is IStyleInterface ctrl)
{
if (!ctrl.StyleCustomMode) ctrl.Style = Style;
}
UIStyleHelper.SetRawControlStyle(e, Style);
}
private UICornerRadiusSides _radiusSides = UICornerRadiusSides.All;
[DefaultValue(UICornerRadiusSides.All), Description("圆角显示位置"), Category("SunnyUI")]
public UICornerRadiusSides RadiusSides
{
get => _radiusSides;
set
{
_radiusSides = value;
OnRadiusSidesChange();
Invalidate();
}
}
/// <summary>
/// 是否显示圆角
/// </summary>
[Description("是否显示圆角"), Category("SunnyUI")]
protected bool ShowRadius => (int)RadiusSides > 0;
//圆角角度
[Description("圆角角度"), Category("SunnyUI")]
[DefaultValue(5)]
public int Radius
{
get
{
return radius;
}
set
{
if (radius != value)
{
radius = Math.Max(0, value);
OnRadiusChanged(radius);
Invalidate();
}
}
}
/// <summary>
/// 是否显示边框
/// </summary>
[Description("是否显示边框"), Category("SunnyUI")]
[DefaultValue(true)]
protected bool ShowRect => (int)RectSides > 0;
/// <summary>
/// 边框颜色
/// </summary>
[Description("边框颜色"), Category("SunnyUI")]
[DefaultValue(typeof(Color), "80, 160, 255")]
public Color RectColor
{
get
{
return rectColor;
}
set
{
if (rectColor != value)
{
rectColor = value;
RectColorChanged?.Invoke(this, null);
SetStyleCustom();
}
AfterSetRectColor(value);
}
}
/// <summary>
/// 填充颜色,当值为背景色或透明色或空值则不填充
/// </summary>
[Description("填充颜色,当值为背景色或透明色或空值则不填充"), Category("SunnyUI")]
[DefaultValue(typeof(Color), "243, 249, 255")]
public Color FillColor
{
get
{
return fillColor;
}
set
{
if (fillColor != value)
{
fillColor = value;
FillColorChanged?.Invoke(this, null);
SetStyleCustom();
}
AfterSetFillColor(value);
}
}
private bool fillColorGradient;
[Description("填充颜色渐变"), Category("SunnyUI")]
[DefaultValue(false)]
public bool FillColorGradient
{
get => fillColorGradient;
set
{
if (fillColorGradient != value)
{
fillColorGradient = value;
Invalidate();
}
}
}
/// <summary>
/// 设置填充颜色
/// </summary>
/// <param name="value">颜色</param>
protected void SetFillColor2(Color value)
{
if (fillColor2 != value)
{
fillColor2 = value;
SetStyleCustom();
}
}
/// <summary>
/// 填充颜色,当值为背景色或透明色或空值则不填充
/// </summary>
[Description("填充颜色"), Category("SunnyUI")]
[DefaultValue(typeof(Color), "243, 249, 255")]
public Color FillColor2
{
get => fillColor2;
set => SetFillColor2(value);
}
protected void SetFillDisableColor(Color color)
{
fillDisableColor = color;
SetStyleCustom();
}
protected void SetRectDisableColor(Color color)
{
rectDisableColor = color;
SetStyleCustom();
}
protected void SetForeDisableColor(Color color)
{
foreDisableColor = color;
SetStyleCustom();
}
private bool showText = true;
[Description("是否显示文字"), Category("SunnyUI")]
[Browsable(false)]
protected bool ShowText
{
get => showText;
set
{
if (showText != value)
{
showText = value;
Invalidate();
}
}
}
private bool showFill = true;
/// <summary>
/// 是否显示填充
/// </summary>
protected bool ShowFill
{
get => showFill;
set
{
if (showFill != value)
{
showFill = value;
Invalidate();
}
}
}
protected override void OnPaint(PaintEventArgs e)
{
if (!Visible || Width <= 0 || Height <= 0) return;
if (IsDisposed) return;
Rectangle rect = new Rectangle(0, 0, Width - 1, Height - 1);
GraphicsPath path = rect.CreateRoundedRectanglePath(radius, RadiusSides, RectSize);
//填充背景色
if (BackgroundImage == null && ShowFill && fillColor.IsValid())
{
OnPaintFill(e.Graphics, path);
}
//填充边框色
if (ShowRect)
{
OnPaintRect(e.Graphics, path);
}
//填充文字
if (ShowText)
{
rect = new Rectangle(1, 1, Width - 3, Height - 3);
using (var path1 = rect.GraphicsPath())
{
OnPaintFore(e.Graphics, path1);
}
}
path.Dispose();
base.OnPaint(e);
}
protected virtual void OnPaintFore(Graphics g, GraphicsPath path)
{
g.DrawString(Text, Font, GetForeColor(), Size, Padding, TextAlignment);
}
protected virtual void OnPaintRect(Graphics g, GraphicsPath path)
{
radius = Math.Min(radius, Math.Min(Width, Height));
if (RectSides == ToolStripStatusLabelBorderSides.None)
{
return;
}
if (RadiusSides == UICornerRadiusSides.None || Radius == 0)
{
//IsRadius为False时显示左侧边线
bool ShowRectLeft = RectSides.GetValue(ToolStripStatusLabelBorderSides.Left);
//IsRadius为False时显示上侧边线
bool ShowRectTop = RectSides.GetValue(ToolStripStatusLabelBorderSides.Top);
//IsRadius为False时显示右侧边线
bool ShowRectRight = RectSides.GetValue(ToolStripStatusLabelBorderSides.Right);
//IsRadius为False时显示下侧边线
bool ShowRectBottom = RectSides.GetValue(ToolStripStatusLabelBorderSides.Bottom);
if (ShowRectLeft)
g.DrawLine(GetRectColor(), RectSize - 1, 0, RectSize - 1, Height, false, RectSize);
if (ShowRectTop)
g.DrawLine(GetRectColor(), 0, RectSize - 1, Width, RectSize - 1, false, RectSize);
if (ShowRectRight)
g.DrawLine(GetRectColor(), Width - 1, 0, Width - 1, Height, false, RectSize);
if (ShowRectBottom)
g.DrawLine(GetRectColor(), 0, Height - 1, Width, Height - 1, false, RectSize);
}
else
{
g.DrawPath(GetRectColor(), path, true, RectSize);
PaintRectDisableSides(g);
}
}
private void PaintRectDisableSides(Graphics g)
{
//IsRadius为False时显示左侧边线
bool ShowRectLeft = RectSides.GetValue(ToolStripStatusLabelBorderSides.Left);
//IsRadius为False时显示上侧边线
bool ShowRectTop = RectSides.GetValue(ToolStripStatusLabelBorderSides.Top);
//IsRadius为False时显示右侧边线
bool ShowRectRight = RectSides.GetValue(ToolStripStatusLabelBorderSides.Right);
//IsRadius为False时显示下侧边线
bool ShowRectBottom = RectSides.GetValue(ToolStripStatusLabelBorderSides.Bottom);
//IsRadius为True时显示左上圆角
bool RadiusLeftTop = RadiusSides.GetValue(UICornerRadiusSides.LeftTop);
//IsRadius为True时显示左下圆角
bool RadiusLeftBottom = RadiusSides.GetValue(UICornerRadiusSides.LeftBottom);
//IsRadius为True时显示右上圆角
bool RadiusRightTop = RadiusSides.GetValue(UICornerRadiusSides.RightTop);
//IsRadius为True时显示右下圆角
bool RadiusRightBottom = RadiusSides.GetValue(UICornerRadiusSides.RightBottom);
var ShowRadius = RadiusSides > 0 && Radius > 0;//肯定少有一个角显示圆角
if (!ShowRadius) return;
if (!ShowRectLeft && !RadiusLeftBottom && !RadiusLeftTop)
{
g.DrawLine(GetFillColor(), RectSize - 1, 0, RectSize - 1, Height, false, RectSize);
}
if (!ShowRectTop && !RadiusRightTop && !RadiusLeftTop)
{
g.DrawLine(GetFillColor(), 0, RectSize - 1, Width, RectSize - 1, false, RectSize);
}
if (!ShowRectRight && !RadiusRightTop && !RadiusRightBottom)
{
g.DrawLine(GetFillColor(), Width - 1, 0, Width - 1, Height, false, RectSize);
}
if (!ShowRectBottom && !RadiusLeftBottom && !RadiusRightBottom)
{
g.DrawLine(GetFillColor(), 0, Height - 1, Width, Height - 1, false, RectSize);
}
}
protected virtual void OnPaintFill(Graphics g, GraphicsPath path)
{
Color color = GetFillColor();
if (fillColorGradient)
{
LinearGradientBrush br = new LinearGradientBrush(new Point(0, 0), new Point(0, Height), FillColor, FillColor2);
br.GammaCorrection = true;
if (RadiusSides == UICornerRadiusSides.None)
g.FillRectangle(br, ClientRectangle);
else
g.FillPath(br, path);
br.Dispose();
}
else
{
if (RadiusSides == UICornerRadiusSides.None)
g.Clear(color);
else
g.FillPath(color, path);
}
}
protected virtual void AfterSetFillColor(Color color)
{
}
protected virtual void AfterSetRectColor(Color color)
{
}
protected virtual void AfterSetForeColor(Color color)
{
}
protected virtual void AfterSetFillReadOnlyColor(Color color)
{
}
protected virtual void AfterSetRectReadOnlyColor(Color color)
{
}
protected virtual void AfterSetForeReadOnlyColor(Color color)
{
}
/// <summary>
/// 自定义主题风格
/// </summary>
[DefaultValue(false)]
[Description("获取或设置可以自定义主题风格"), Category("SunnyUI")]
public bool StyleCustomMode
{
get; set;
}
protected UIStyle _style = UIStyle.Blue;
/// <summary>
/// 主题样式
/// </summary>
[DefaultValue(UIStyle.Blue), Description("主题样式"), Category("SunnyUI")]
public UIStyle Style
{
get => _style;
set => SetStyle(value);
}
public void SetStyle(UIStyle style)
{
this.SuspendLayout();
UIStyleHelper.SetChildUIStyle(this, style);
if (!style.IsCustom())
{
SetStyleColor(style.Colors());
Invalidate();
}
_style = style;
this.ResumeLayout();
}
public virtual void SetStyleColor(UIBaseStyle uiColor)
{
fillColor2 = uiColor.PanelFillColor2;
fillColor = uiColor.PanelFillColor;
rectColor = uiColor.PanelRectColor;
foreColor = uiColor.PanelForeColor;
fillDisableColor = uiColor.FillDisableColor;
rectDisableColor = uiColor.RectDisableColor;
foreDisableColor = uiColor.ForeDisableColor;
fillReadOnlyColor = uiColor.FillDisableColor;
rectReadOnlyColor = uiColor.RectDisableColor;
foreReadOnlyColor = uiColor.ForeDisableColor;
}
/// <summary>
/// 设置填充只读颜色
/// </summary>
/// <param name="color">颜色</param>
protected void SetFillReadOnlyColor(Color color)
{
fillReadOnlyColor = color;
AfterSetFillReadOnlyColor(color);
SetStyleCustom();
}
/// <summary>
/// 设置边框只读颜色
/// </summary>
/// <param name="color">颜色</param>
protected void SetRectReadOnlyColor(Color color)
{
rectReadOnlyColor = color;
AfterSetRectReadOnlyColor(color);
SetStyleCustom();
}
/// <summary>
/// 设置字体只读颜色
/// </summary>
/// <param name="color">颜色</param>
protected void SetForeReadOnlyColor(Color color)
{
foreReadOnlyColor = color;
AfterSetForeReadOnlyColor(color);
SetStyleCustom();
}
/// <summary> /// <summary>
/// 字体颜色 /// 字体颜色
/// </summary> /// </summary>
@ -635,22 +60,6 @@ namespace Sunny.UI
} }
} }
[DefaultValue(typeof(Color), "244, 244, 244")]
[Description("不可用时填充颜色"), Category("SunnyUI")]
public Color FillDisableColor
{
get => fillDisableColor;
set => SetFillDisableColor(value);
}
[DefaultValue(typeof(Color), "173, 178, 181")]
[Description("不可用时边框颜色"), Category("SunnyUI")]
public Color RectDisableColor
{
get => rectDisableColor;
set => SetRectDisableColor(value);
}
[DefaultValue(typeof(Color), "109, 109, 103")] [DefaultValue(typeof(Color), "109, 109, 103")]
[Description("不可用时字体颜色"), Category("SunnyUI")] [Description("不可用时字体颜色"), Category("SunnyUI")]
public Color ForeDisableColor public Color ForeDisableColor
@ -659,113 +68,31 @@ namespace Sunny.UI
set => SetForeDisableColor(value); set => SetForeDisableColor(value);
} }
protected virtual void OnRadiusChanged(int value) [Description("是否显示文字"), Category("SunnyUI")]
[DefaultValue(true)]
[Browsable(false)]
public bool ShowText
{ {
} get => showText;
protected Color foreDisableColor = UIStyles.Blue.ForeDisableColor;
protected Color rectDisableColor = UIStyles.Blue.RectDisableColor;
protected Color fillDisableColor = UIStyles.Blue.FillDisableColor;
/// <summary>
/// 字体只读颜色
/// </summary>
protected Color foreReadOnlyColor = UIStyles.Blue.ForeDisableColor;
/// <summary>
/// 边框只读颜色
/// </summary>
protected Color rectReadOnlyColor = UIStyles.Blue.RectDisableColor;
/// <summary>
/// 填充只读颜色
/// </summary>
protected Color fillReadOnlyColor = UIStyles.Blue.FillDisableColor;
protected Color GetRectColor()
{
return Enabled ? (isReadOnly ? rectReadOnlyColor : rectColor) : rectDisableColor;
}
protected Color GetForeColor()
{
return Enabled ? (isReadOnly ? foreReadOnlyColor : foreColor) : foreDisableColor;
}
protected Color GetFillColor()
{
return Enabled ? (isReadOnly ? fillReadOnlyColor : fillColor) : fillDisableColor;
}
/// <summary>
/// 屏蔽原属性,获取或设置一个值,该值指示是否在 Windows 任务栏中显示窗体。
/// </summary>
/// <value><c>true</c> if [show in taskbar]; otherwise, <c>false</c>.</value>
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("禁用该属性!", true)]
public new BorderStyle BorderStyle => BorderStyle.None;
public event EventHandler FillColorChanged;
public event EventHandler RectColorChanged;
public string Version
{
get;
}
private ContentAlignment _textAlignment = ContentAlignment.MiddleCenter;
/// <summary>
/// 文字对齐方向
/// </summary>
[Description("文字对齐方向"), Category("SunnyUI")]
public ContentAlignment TextAlignment
{
get => _textAlignment;
set set
{ {
_textAlignment = value; if (showText != value)
TextAlignmentChange?.Invoke(this, value);
Invalidate();
}
}
public delegate void OnTextAlignmentChange(object sender, ContentAlignment alignment);
public event OnTextAlignmentChange TextAlignmentChange;
private int rectSize = 1;
/// <summary>
/// 边框颜色
/// </summary>
[Description("边框宽度"), Category("SunnyUI")]
[DefaultValue(1)]
public int RectSize
{
get => rectSize;
set
{
int v = value;
if (v > 2) v = 2;
if (v < 1) v = 1;
if (rectSize != v)
{ {
rectSize = v; showText = value;
Invalidate(); Invalidate();
} }
} }
} }
[Browsable(false)] /// <summary>
public new bool AutoScroll { get; set; } = false; /// 设置字体只读颜色
/// </summary>
protected void SetStyleCustom(bool needRefresh = true) /// <param name="color">颜色</param>
protected void SetForeReadOnlyColor(Color color)
{ {
_style = UIStyle.Custom; foreReadOnlyColor = color;
if (needRefresh) Invalidate(); AfterSetForeReadOnlyColor(color);
SetStyleCustom();
} }
} }
} }

View File

@ -0,0 +1,37 @@
namespace Sunny.UI
{
partial class UIUserControl
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
}
#endregion
}
}

View File

@ -0,0 +1,714 @@
/******************************************************************************
* SunnyUI
* CopyRight (C) 2012-2022 ShenYongHua().
* QQ群56829229 QQ17612584 EMailSunnyUI@QQ.Com
*
* Blog: https://www.cnblogs.com/yhuse
* Gitee: https://gitee.com/yhuse/SunnyUI
* GitHub: https://github.com/yhuse/SunnyUI
*
* SunnyUI.dll can be used for free under the GPL-3.0 license.
* If you use this code, please keep this note.
* 使
******************************************************************************
* : UIUserControl.cs
* :
* : V3.1
* : 2020-01-01
*
* 2022-04-02: V3.1.1
******************************************************************************/
using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
#pragma warning disable 1591
namespace Sunny.UI
{
[Designer("System.Windows.Forms.Design.ParentControlDesigner, System.Design", typeof(System.ComponentModel.Design.IDesigner))]
[DefaultEvent("Click"), DefaultProperty("Text")]
public partial class UIUserControl : UserControl, IStyleInterface
{
private int radius = 5;
protected Color rectColor = UIStyles.Blue.PanelRectColor;
protected Color fillColor = UIStyles.Blue.PanelFillColor;
protected Color foreColor = UIStyles.Blue.PanelForeColor;
protected Color fillColor2 = UIStyles.Blue.PanelFillColor2;
protected bool InitializeComponentEnd;
public UIUserControl()
{
InitializeComponent();
Version = UIGlobal.Version;
AutoScaleMode = AutoScaleMode.None;
base.Font = UIFontColor.Font();
base.MinimumSize = new System.Drawing.Size(1, 1);
SetStyleFlags(true, false);
}
[Browsable(false), DefaultValue(false)]
public bool IsScaled { get; set; }
public virtual void SetDPIScale()
{
if (!IsScaled)
{
this.SetDPIScaleFont();
IsScaled = true;
}
}
protected bool isReadOnly;
protected void SetStyleFlags(bool supportTransparent = true, bool selectable = true, bool resizeRedraw = false)
{
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.DoubleBuffer, true);
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
if (supportTransparent) SetStyle(ControlStyles.SupportsTransparentBackColor, true);
if (selectable) SetStyle(ControlStyles.Selectable, true);
if (resizeRedraw) SetStyle(ControlStyles.ResizeRedraw, true);
base.DoubleBuffered = true;
UpdateStyles();
}
protected override void OnSizeChanged(EventArgs e)
{
base.OnSizeChanged(e);
Invalidate();
}
/// <summary>
/// Tag字符串
/// </summary>
[DefaultValue(null)]
[Description("获取或设置包含有关控件的数据的对象字符串"), Category("SunnyUI")]
public string TagString
{
get; set;
}
private string text;
[Category("SunnyUI")]
[Description("显示文字")]
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
[DefaultValue("")]
public override string Text
{
get
{
return text;
}
set
{
if (text != value)
{
text = value;
Invalidate();
}
}
}
protected bool IsDesignMode
{
get
{
if (LicenseManager.UsageMode == LicenseUsageMode.Designtime)
{
return true;
}
else if (System.Diagnostics.Process.GetCurrentProcess().ProcessName == "devenv")
{
return true;
}
return false;
}
}
private ToolStripStatusLabelBorderSides _rectSides = ToolStripStatusLabelBorderSides.All;
[DefaultValue(ToolStripStatusLabelBorderSides.All), Description("边框显示位置"), Category("SunnyUI")]
public ToolStripStatusLabelBorderSides RectSides
{
get => _rectSides;
set
{
_rectSides = value;
OnRectSidesChange();
Invalidate();
}
}
protected virtual void OnRadiusSidesChange()
{
}
protected virtual void OnRectSidesChange()
{
}
protected override void OnControlAdded(ControlEventArgs e)
{
base.OnControlAdded(e);
if (e.Control is IStyleInterface ctrl)
{
if (!ctrl.StyleCustomMode) ctrl.Style = Style;
}
UIStyleHelper.SetRawControlStyle(e, Style);
}
private UICornerRadiusSides _radiusSides = UICornerRadiusSides.All;
[DefaultValue(UICornerRadiusSides.All), Description("圆角显示位置"), Category("SunnyUI")]
public UICornerRadiusSides RadiusSides
{
get => _radiusSides;
set
{
_radiusSides = value;
OnRadiusSidesChange();
Invalidate();
}
}
/// <summary>
/// 是否显示圆角
/// </summary>
[Description("是否显示圆角"), Category("SunnyUI")]
protected bool ShowRadius => (int)RadiusSides > 0;
//圆角角度
[Description("圆角角度"), Category("SunnyUI")]
[DefaultValue(5)]
public int Radius
{
get
{
return radius;
}
set
{
if (radius != value)
{
radius = Math.Max(0, value);
OnRadiusChanged(radius);
Invalidate();
}
}
}
/// <summary>
/// 是否显示边框
/// </summary>
[Description("是否显示边框"), Category("SunnyUI")]
[DefaultValue(true)]
protected bool ShowRect => (int)RectSides > 0;
/// <summary>
/// 边框颜色
/// </summary>
[Description("边框颜色"), Category("SunnyUI")]
[DefaultValue(typeof(Color), "80, 160, 255")]
public Color RectColor
{
get
{
return rectColor;
}
set
{
if (rectColor != value)
{
rectColor = value;
RectColorChanged?.Invoke(this, null);
SetStyleCustom();
}
AfterSetRectColor(value);
}
}
/// <summary>
/// 填充颜色,当值为背景色或透明色或空值则不填充
/// </summary>
[Description("填充颜色,当值为背景色或透明色或空值则不填充"), Category("SunnyUI")]
[DefaultValue(typeof(Color), "243, 249, 255")]
public Color FillColor
{
get
{
return fillColor;
}
set
{
if (fillColor != value)
{
fillColor = value;
FillColorChanged?.Invoke(this, null);
SetStyleCustom();
}
AfterSetFillColor(value);
}
}
private bool fillColorGradient;
[Description("填充颜色渐变"), Category("SunnyUI")]
[DefaultValue(false)]
public bool FillColorGradient
{
get => fillColorGradient;
set
{
if (fillColorGradient != value)
{
fillColorGradient = value;
Invalidate();
}
}
}
/// <summary>
/// 设置填充颜色
/// </summary>
/// <param name="value">颜色</param>
protected void SetFillColor2(Color value)
{
if (fillColor2 != value)
{
fillColor2 = value;
SetStyleCustom();
}
}
/// <summary>
/// 填充颜色,当值为背景色或透明色或空值则不填充
/// </summary>
[Description("填充颜色"), Category("SunnyUI")]
[DefaultValue(typeof(Color), "243, 249, 255")]
public Color FillColor2
{
get => fillColor2;
set => SetFillColor2(value);
}
protected void SetFillDisableColor(Color color)
{
fillDisableColor = color;
SetStyleCustom();
}
protected void SetRectDisableColor(Color color)
{
rectDisableColor = color;
SetStyleCustom();
}
protected void SetForeDisableColor(Color color)
{
foreDisableColor = color;
SetStyleCustom();
}
protected bool showText = false;
private bool showFill = true;
/// <summary>
/// 是否显示填充
/// </summary>
protected bool ShowFill
{
get => showFill;
set
{
if (showFill != value)
{
showFill = value;
Invalidate();
}
}
}
protected override void OnVisibleChanged(EventArgs e)
{
base.OnVisibleChanged(e);
if (AutoScaleMode == AutoScaleMode.Font) AutoScaleMode = AutoScaleMode.None;
}
protected override void OnPaint(PaintEventArgs e)
{
if (!Visible || Width <= 0 || Height <= 0) return;
if (IsDisposed) return;
Rectangle rect = new Rectangle(0, 0, Width - 1, Height - 1);
GraphicsPath path = rect.CreateRoundedRectanglePath(radius, RadiusSides, RectSize);
//填充背景色
if (BackgroundImage == null && ShowFill && fillColor.IsValid())
{
OnPaintFill(e.Graphics, path);
}
//填充边框色
if (ShowRect)
{
OnPaintRect(e.Graphics, path);
}
//填充文字
rect = new Rectangle(1, 1, Width - 3, Height - 3);
using (var path1 = rect.GraphicsPath())
{
OnPaintFore(e.Graphics, path1);
}
path.Dispose();
base.OnPaint(e);
}
protected virtual void OnPaintFore(Graphics g, GraphicsPath path)
{
string text = Text;
if (!showText && Text.IsValid()) text = "";
g.DrawString(text, Font, GetForeColor(), Size, Padding, TextAlignment);
}
protected virtual void OnPaintRect(Graphics g, GraphicsPath path)
{
radius = Math.Min(radius, Math.Min(Width, Height));
if (RectSides == ToolStripStatusLabelBorderSides.None)
{
return;
}
if (RadiusSides == UICornerRadiusSides.None || Radius == 0)
{
//IsRadius为False时显示左侧边线
bool ShowRectLeft = RectSides.GetValue(ToolStripStatusLabelBorderSides.Left);
//IsRadius为False时显示上侧边线
bool ShowRectTop = RectSides.GetValue(ToolStripStatusLabelBorderSides.Top);
//IsRadius为False时显示右侧边线
bool ShowRectRight = RectSides.GetValue(ToolStripStatusLabelBorderSides.Right);
//IsRadius为False时显示下侧边线
bool ShowRectBottom = RectSides.GetValue(ToolStripStatusLabelBorderSides.Bottom);
if (ShowRectLeft)
g.DrawLine(GetRectColor(), RectSize - 1, 0, RectSize - 1, Height, false, RectSize);
if (ShowRectTop)
g.DrawLine(GetRectColor(), 0, RectSize - 1, Width, RectSize - 1, false, RectSize);
if (ShowRectRight)
g.DrawLine(GetRectColor(), Width - 1, 0, Width - 1, Height, false, RectSize);
if (ShowRectBottom)
g.DrawLine(GetRectColor(), 0, Height - 1, Width, Height - 1, false, RectSize);
}
else
{
g.DrawPath(GetRectColor(), path, true, RectSize);
PaintRectDisableSides(g);
}
}
private void PaintRectDisableSides(Graphics g)
{
//IsRadius为False时显示左侧边线
bool ShowRectLeft = RectSides.GetValue(ToolStripStatusLabelBorderSides.Left);
//IsRadius为False时显示上侧边线
bool ShowRectTop = RectSides.GetValue(ToolStripStatusLabelBorderSides.Top);
//IsRadius为False时显示右侧边线
bool ShowRectRight = RectSides.GetValue(ToolStripStatusLabelBorderSides.Right);
//IsRadius为False时显示下侧边线
bool ShowRectBottom = RectSides.GetValue(ToolStripStatusLabelBorderSides.Bottom);
//IsRadius为True时显示左上圆角
bool RadiusLeftTop = RadiusSides.GetValue(UICornerRadiusSides.LeftTop);
//IsRadius为True时显示左下圆角
bool RadiusLeftBottom = RadiusSides.GetValue(UICornerRadiusSides.LeftBottom);
//IsRadius为True时显示右上圆角
bool RadiusRightTop = RadiusSides.GetValue(UICornerRadiusSides.RightTop);
//IsRadius为True时显示右下圆角
bool RadiusRightBottom = RadiusSides.GetValue(UICornerRadiusSides.RightBottom);
var ShowRadius = RadiusSides > 0 && Radius > 0;//肯定少有一个角显示圆角
if (!ShowRadius) return;
if (!ShowRectLeft && !RadiusLeftBottom && !RadiusLeftTop)
{
g.DrawLine(GetFillColor(), RectSize - 1, 0, RectSize - 1, Height, false, RectSize);
}
if (!ShowRectTop && !RadiusRightTop && !RadiusLeftTop)
{
g.DrawLine(GetFillColor(), 0, RectSize - 1, Width, RectSize - 1, false, RectSize);
}
if (!ShowRectRight && !RadiusRightTop && !RadiusRightBottom)
{
g.DrawLine(GetFillColor(), Width - 1, 0, Width - 1, Height, false, RectSize);
}
if (!ShowRectBottom && !RadiusLeftBottom && !RadiusRightBottom)
{
g.DrawLine(GetFillColor(), 0, Height - 1, Width, Height - 1, false, RectSize);
}
}
protected virtual void OnPaintFill(Graphics g, GraphicsPath path)
{
Color color = GetFillColor();
if (fillColorGradient)
{
LinearGradientBrush br = new LinearGradientBrush(new Point(0, 0), new Point(0, Height), FillColor, FillColor2);
br.GammaCorrection = true;
if (RadiusSides == UICornerRadiusSides.None)
g.FillRectangle(br, ClientRectangle);
else
g.FillPath(br, path);
br.Dispose();
}
else
{
if (RadiusSides == UICornerRadiusSides.None || Radius == 0)
g.Clear(color);
else
g.FillPath(color, path);
}
}
protected virtual void AfterSetFillColor(Color color)
{
}
protected virtual void AfterSetRectColor(Color color)
{
}
protected virtual void AfterSetForeColor(Color color)
{
}
protected virtual void AfterSetFillReadOnlyColor(Color color)
{
}
protected virtual void AfterSetRectReadOnlyColor(Color color)
{
}
protected virtual void AfterSetForeReadOnlyColor(Color color)
{
}
/// <summary>
/// 自定义主题风格
/// </summary>
[DefaultValue(false)]
[Description("获取或设置可以自定义主题风格"), Category("SunnyUI")]
public bool StyleCustomMode
{
get; set;
}
protected UIStyle _style = UIStyle.Blue;
/// <summary>
/// 主题样式
/// </summary>
[DefaultValue(UIStyle.Blue), Description("主题样式"), Category("SunnyUI")]
public UIStyle Style
{
get => _style;
set => SetStyle(value);
}
public void SetStyle(UIStyle style)
{
this.SuspendLayout();
UIStyleHelper.SetChildUIStyle(this, style);
if (!style.IsCustom())
{
SetStyleColor(style.Colors());
Invalidate();
}
_style = style;
this.ResumeLayout();
}
public virtual void SetStyleColor(UIBaseStyle uiColor)
{
fillColor2 = uiColor.PanelFillColor2;
fillColor = uiColor.PanelFillColor;
rectColor = uiColor.PanelRectColor;
foreColor = uiColor.PanelForeColor;
fillDisableColor = uiColor.FillDisableColor;
rectDisableColor = uiColor.RectDisableColor;
foreDisableColor = uiColor.ForeDisableColor;
fillReadOnlyColor = uiColor.FillDisableColor;
rectReadOnlyColor = uiColor.RectDisableColor;
foreReadOnlyColor = uiColor.ForeDisableColor;
}
/// <summary>
/// 设置填充只读颜色
/// </summary>
/// <param name="color">颜色</param>
protected void SetFillReadOnlyColor(Color color)
{
fillReadOnlyColor = color;
AfterSetFillReadOnlyColor(color);
SetStyleCustom();
}
/// <summary>
/// 设置边框只读颜色
/// </summary>
/// <param name="color">颜色</param>
protected void SetRectReadOnlyColor(Color color)
{
rectReadOnlyColor = color;
AfterSetRectReadOnlyColor(color);
SetStyleCustom();
}
[DefaultValue(typeof(Color), "244, 244, 244")]
[Description("不可用时填充颜色"), Category("SunnyUI")]
public Color FillDisableColor
{
get => fillDisableColor;
set => SetFillDisableColor(value);
}
[DefaultValue(typeof(Color), "173, 178, 181")]
[Description("不可用时边框颜色"), Category("SunnyUI")]
public Color RectDisableColor
{
get => rectDisableColor;
set => SetRectDisableColor(value);
}
protected virtual void OnRadiusChanged(int value)
{
}
protected Color foreDisableColor = UIStyles.Blue.ForeDisableColor;
protected Color rectDisableColor = UIStyles.Blue.RectDisableColor;
protected Color fillDisableColor = UIStyles.Blue.FillDisableColor;
/// <summary>
/// 字体只读颜色
/// </summary>
protected Color foreReadOnlyColor = UIStyles.Blue.ForeDisableColor;
/// <summary>
/// 边框只读颜色
/// </summary>
protected Color rectReadOnlyColor = UIStyles.Blue.RectDisableColor;
/// <summary>
/// 填充只读颜色
/// </summary>
protected Color fillReadOnlyColor = UIStyles.Blue.FillDisableColor;
protected Color GetRectColor()
{
return Enabled ? (isReadOnly ? rectReadOnlyColor : rectColor) : rectDisableColor;
}
protected Color GetForeColor()
{
return Enabled ? (isReadOnly ? foreReadOnlyColor : foreColor) : foreDisableColor;
}
protected Color GetFillColor()
{
return Enabled ? (isReadOnly ? fillReadOnlyColor : fillColor) : fillDisableColor;
}
/// <summary>
/// 屏蔽原属性,获取或设置一个值,该值指示是否在 Windows 任务栏中显示窗体。
/// </summary>
/// <value><c>true</c> if [show in taskbar]; otherwise, <c>false</c>.</value>
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("禁用该属性!", true)]
public new BorderStyle BorderStyle => BorderStyle.None;
public event EventHandler FillColorChanged;
public event EventHandler RectColorChanged;
public string Version
{
get;
}
private ContentAlignment _textAlignment = ContentAlignment.MiddleCenter;
/// <summary>
/// 文字对齐方向
/// </summary>
[Description("文字对齐方向"), Category("SunnyUI")]
public ContentAlignment TextAlignment
{
get => _textAlignment;
set
{
_textAlignment = value;
TextAlignmentChange?.Invoke(this, value);
Invalidate();
}
}
public delegate void OnTextAlignmentChange(object sender, ContentAlignment alignment);
public event OnTextAlignmentChange TextAlignmentChange;
private int rectSize = 1;
/// <summary>
/// 边框颜色
/// </summary>
[Description("边框宽度"), Category("SunnyUI")]
[DefaultValue(1)]
public int RectSize
{
get => rectSize;
set
{
int v = value;
if (v > 2) v = 2;
if (v < 1) v = 1;
if (rectSize != v)
{
rectSize = v;
Invalidate();
}
}
}
[Browsable(false)]
public new bool AutoScroll { get; set; } = false;
protected void SetStyleCustom(bool needRefresh = true)
{
_style = UIStyle.Custom;
if (needRefresh) Invalidate();
}
}
}

View File

@ -1293,6 +1293,8 @@ namespace Sunny.UI
protected override void OnShown(EventArgs e) protected override void OnShown(EventArgs e)
{ {
base.OnShown(e); base.OnShown(e);
if (AutoScaleMode == AutoScaleMode.Font) AutoScaleMode = AutoScaleMode.None;
CalcSystemBoxPos(); CalcSystemBoxPos();
SetRadius(); SetRadius();
isShow = true; isShow = true;

View File

@ -180,15 +180,6 @@ namespace Sunny.UI.Properties {
} }
} }
/// <summary>
/// 查找类似 SunnyUI.Net 的本地化字符串。
/// </summary>
internal static string Name {
get {
return ResourceManager.GetString("Name", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary> /// </summary>
@ -199,15 +190,6 @@ namespace Sunny.UI.Properties {
} }
} }
/// <summary>
/// 查找类似 V3.1.2 的本地化字符串。
/// </summary>
internal static string Version {
get {
return ResourceManager.GetString("Version", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary> /// </summary>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<root> <root>
<!-- <!--
Microsoft ResX Schema Microsoft ResX Schema
Version 2.0 Version 2.0
@ -59,116 +59,108 @@
: using a System.ComponentModel.TypeConverter : using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
--> -->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true"> <xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType> <xsd:complexType>
<xsd:choice maxOccurs="unbounded"> <xsd:sequence>
<xsd:element name="metadata"> <xsd:element name="value" type="xsd:string" minOccurs="0" />
<xsd:complexType> </xsd:sequence>
<xsd:sequence> <xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:element name="value" type="xsd:string" minOccurs="0" /> <xsd:attribute name="type" type="xsd:string" />
</xsd:sequence> <xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute name="name" use="required" type="xsd:string" /> <xsd:attribute ref="xml:space" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
</xsd:schema> <xsd:element name="assembly">
<resheader name="resmimetype"> <xsd:complexType>
<value>text/microsoft-resx</value> <xsd:attribute name="alias" type="xsd:string" />
</resheader> <xsd:attribute name="name" type="xsd:string" />
<resheader name="version"> </xsd:complexType>
<value>2.0</value> </xsd:element>
</resheader> <xsd:element name="data">
<resheader name="reader"> <xsd:complexType>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <xsd:sequence>
</resheader> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<resheader name="writer"> <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </xsd:sequence>
</resheader> <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<data name="close" type="System.Resources.ResXFileRef, System.Windows.Forms"> <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<value>..\Resources\close.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <xsd:attribute ref="xml:space" />
</data> </xsd:complexType>
<data name="colorbarIndicators" type="System.Resources.ResXFileRef, System.Windows.Forms"> </xsd:element>
<value>..\Resources\colorbarIndicators.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <xsd:element name="resheader">
</data> <xsd:complexType>
<data name="gps1" type="System.Resources.ResXFileRef, System.Windows.Forms"> <xsd:sequence>
<value>..\Resources\gps1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</data> </xsd:sequence>
<data name="gps_postion" type="System.Resources.ResXFileRef, System.Windows.Forms"> <xsd:attribute name="name" type="xsd:string" use="required" />
<value>..\Resources\gps_postion.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> </xsd:complexType>
</data> </xsd:element>
<data name="img_notifier" type="System.Resources.ResXFileRef, System.Windows.Forms"> </xsd:choice>
<value>..\Resources\img_notifier.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> </xsd:complexType>
</data> </xsd:element>
<data name="Login1" type="System.Resources.ResXFileRef, System.Windows.Forms"> </xsd:schema>
<value>..\Resources\Login1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <resheader name="resmimetype">
</data> <value>text/microsoft-resx</value>
<data name="Login2" type="System.Resources.ResXFileRef, System.Windows.Forms"> </resheader>
<value>..\Resources\Login2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <resheader name="version">
</data> <value>2.0</value>
<data name="Login3" type="System.Resources.ResXFileRef, System.Windows.Forms"> </resheader>
<value>..\Resources\Login3.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <resheader name="reader">
</data> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<data name="Login4" type="System.Resources.ResXFileRef, System.Windows.Forms"> </resheader>
<value>..\Resources\Login4.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <resheader name="writer">
</data> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<data name="Login5" type="System.Resources.ResXFileRef, System.Windows.Forms"> </resheader>
<value>..\Resources\Login5.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</data> <data name="close" type="System.Resources.ResXFileRef, System.Windows.Forms">
<data name="Login6" type="System.Resources.ResXFileRef, System.Windows.Forms"> <value>..\Resources\close.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<value>..\Resources\Login6.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="menu" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\menu.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Name" xml:space="preserve">
<value>SunnyUI.Net</value>
<comment>SunnyUI.Net 是基于.Net Framework 4.0+、.Net 5 、.Net 6框架的 C# WinForm 开源控件库、工具类库、扩展类库、多页面开发框架。</comment>
</data> </data>
<data name="notifier" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="colorbarIndicators" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\notifier.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\colorbarIndicators.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="Version" xml:space="preserve"> <data name="gps1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>V3.1.2</value> <value>..\Resources\gps1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<comment>2022-03-28</comment> </data>
<data name="gps_postion" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\gps_postion.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="img_notifier" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\img_notifier.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Login1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Login1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Login2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Login2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Login3" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Login3.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Login4" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Login4.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Login5" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Login5.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Login6" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Login6.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="menu" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\menu.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="notifier" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\notifier.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="wind" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\wind.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="wind_postion" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\wind_postion.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="wind" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\wind.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="wind_postion" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\wind_postion.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root> </root>

View File

@ -814,7 +814,7 @@ namespace Sunny.UI
if (obj is UIPage) continue; if (obj is UIPage) continue;
if (obj is UITableLayoutPanel) continue; if (obj is UITableLayoutPanel) continue;
if (obj is UIFlowLayoutPanel) continue; if (obj is UIFlowLayoutPanel) continue;
if (obj is UIPanel) continue; if (obj is UIUserControl) continue;
if (obj is TableLayoutPanel) continue; if (obj is TableLayoutPanel) continue;

View File

@ -1,93 +1,93 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net5.0-windows;net472;net40</TargetFrameworks> <TargetFrameworks>net5.0-windows;net472;net40</TargetFrameworks>
<LangVersion>9.0</LangVersion> <LangVersion>9.0</LangVersion>
<ProjectGuid>{AB1CB247-E20B-4CBE-B269-570ADDD96C53}</ProjectGuid> <ProjectGuid>{AB1CB247-E20B-4CBE-B269-570ADDD96C53}</ProjectGuid>
<UseWindowsForms>true</UseWindowsForms> <UseWindowsForms>true</UseWindowsForms>
<RootNamespace>Sunny.UI</RootNamespace> <RootNamespace>Sunny.UI</RootNamespace>
<Description>SunnyUI.Net 是基于.Net Framework 4.0+、.Net 5、.Net 6 框架的 C# WinForm 开源控件库、工具类库、扩展类库、多页面开发框架。</Description> <Description>SunnyUI.Net 是基于.Net Framework 4.0+、.Net 5、.Net 6 框架的 C# WinForm 开源控件库、工具类库、扩展类库、多页面开发框架。</Description>
<Copyright>CopyRight © SunnyUI.Net 2012-2022</Copyright> <Copyright>CopyRight © SunnyUI.Net 2012-2022</Copyright>
<PackageLicenseFile>LICENSE</PackageLicenseFile> <PackageLicenseFile>LICENSE</PackageLicenseFile>
<Version>3.1.2.1</Version> <Version>3.1.2.1</Version>
<Authors>ShenYonghua</Authors> <Authors>ShenYonghua</Authors>
<Company>SunnyUI.Net</Company> <Company>SunnyUI.Net</Company>
<PackageId>SunnyUI</PackageId> <PackageId>SunnyUI</PackageId>
<PackageProjectUrl>https://gitee.com/yhuse/SunnyUI</PackageProjectUrl> <PackageProjectUrl>https://gitee.com/yhuse/SunnyUI</PackageProjectUrl>
<RepositoryUrl>https://gitee.com/yhuse/SunnyUI</RepositoryUrl> <RepositoryUrl>https://gitee.com/yhuse/SunnyUI</RepositoryUrl>
<PackageRequireLicenseAcceptance>False</PackageRequireLicenseAcceptance> <PackageRequireLicenseAcceptance>False</PackageRequireLicenseAcceptance>
<PackageIcon>SunnyUI.png</PackageIcon> <PackageIcon>SunnyUI.png</PackageIcon>
<SignAssembly>False</SignAssembly> <SignAssembly>False</SignAssembly>
<AssemblyOriginatorKeyFile>D:\MyDocuments\SunnyUI.pfx</AssemblyOriginatorKeyFile> <AssemblyOriginatorKeyFile>D:\MyDocuments\SunnyUI.pfx</AssemblyOriginatorKeyFile>
<DelaySign>False</DelaySign> <DelaySign>False</DelaySign>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild> <GeneratePackageOnBuild>False</GeneratePackageOnBuild>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<OutputPath>..\Bin\</OutputPath> <OutputPath>..\Bin\</OutputPath>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DocumentationFile></DocumentationFile> <DocumentationFile></DocumentationFile>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<OutputPath>..\Bin\</OutputPath> <OutputPath>..\Bin\</OutputPath>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DocumentationFile></DocumentationFile> <DocumentationFile></DocumentationFile>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net5.0-windows|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net5.0-windows|AnyCPU'">
<Optimize>false</Optimize> <Optimize>false</Optimize>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<None Include="..\LICENSE"> <None Include="..\LICENSE">
<Pack>True</Pack> <Pack>True</Pack>
<PackagePath></PackagePath> <PackagePath></PackagePath>
</None> </None>
<None Include="..\SunnyUI.png"> <None Include="..\SunnyUI.png">
<Pack>True</Pack> <Pack>True</Pack>
<PackagePath></PackagePath> <PackagePath></PackagePath>
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="Font\ElegantIcons.ttf" /> <EmbeddedResource Include="Font\ElegantIcons.ttf" />
<EmbeddedResource Include="Font\fa-brands-400.ttf" /> <EmbeddedResource Include="Font\fa-brands-400.ttf" />
<EmbeddedResource Include="Font\fa-regular-400.ttf" /> <EmbeddedResource Include="Font\fa-regular-400.ttf" />
<EmbeddedResource Include="Font\fa-solid-900.ttf" /> <EmbeddedResource Include="Font\fa-solid-900.ttf" />
<EmbeddedResource Include="Font\FontAwesome.ttf" /> <EmbeddedResource Include="Font\FontAwesome.ttf" />
</ItemGroup> </ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net40'"> <ItemGroup Condition="'$(TargetFramework)' == 'net40'">
<Reference Include="System.Windows.Forms" /> <Reference Include="System.Windows.Forms" />
<Reference Include="System.Web.Extensions" /> <Reference Include="System.Web.Extensions" />
<Reference Include="System.Design" /> <Reference Include="System.Design" />
</ItemGroup> </ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net472'"> <ItemGroup Condition="'$(TargetFramework)' == 'net472'">
<Reference Include="System.Windows.Forms" /> <Reference Include="System.Windows.Forms" />
<Reference Include="System.Web.Extensions" /> <Reference Include="System.Web.Extensions" />
<Reference Include="System.Design" /> <Reference Include="System.Design" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="SunnyUI.Common" Version="3.1.2" /> <PackageReference Include="SunnyUI.Common" Version="3.1.2" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Update="Properties\Resources.Designer.cs"> <Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon> <DependentUpon>Resources.resx</DependentUpon>
</Compile> </Compile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx"> <EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource> </EmbeddedResource>
</ItemGroup> </ItemGroup>
</Project> </Project>