diff --git a/Bin/net40/SunnyUI.dll b/Bin/net40/SunnyUI.dll index e1a2a523..1a4da33e 100644 Binary files a/Bin/net40/SunnyUI.dll and b/Bin/net40/SunnyUI.dll differ diff --git a/SunnyUI/Common/UGraphics.cs b/SunnyUI/Common/UGraphics.cs index f7e56d7e..a11f7a67 100644 --- a/SunnyUI/Common/UGraphics.cs +++ b/SunnyUI/Common/UGraphics.cs @@ -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) { + if (str.IsNullOrEmpty()) return; SizeF sf = g.MeasureString(str, font); 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()) { - 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); } } @@ -843,6 +845,7 @@ namespace Sunny.UI /// 角度 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()) { g.DrawStringRotateAtCenter(text, font, br, centerPoint, angle); @@ -860,6 +863,7 @@ namespace Sunny.UI /// 角度 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); float x1 = centerPoint.X - sf.Width / 2.0f; float y1 = centerPoint.Y - sf.Height / 2.0f; @@ -890,6 +894,7 @@ namespace Sunny.UI /// 角度 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 Matrix mtxSave = g.Transform; @@ -903,11 +908,12 @@ namespace Sunny.UI 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()) { - g.DrawString(s, font, br, rotatePoint, format, angle); + g.DrawString(text, font, br, rotatePoint, format, angle); } } @@ -923,6 +929,7 @@ namespace Sunny.UI /// 角度 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); } diff --git a/SunnyUI/Controls/UIGlobal.cs b/SunnyUI/Controls/UIGlobal.cs index f908771b..4ee28d28 100644 --- a/SunnyUI/Controls/UIGlobal.cs +++ b/SunnyUI/Controls/UIGlobal.cs @@ -19,8 +19,6 @@ * 2020-01-01: V2.2.0 增加文件说明 ******************************************************************************/ -using Sunny.UI.Properties; - namespace Sunny.UI { /// @@ -31,7 +29,7 @@ namespace Sunny.UI /// /// 版本 /// - 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 EditorMaxHeight = 60; diff --git a/SunnyUI/Controls/UIPanel.cs b/SunnyUI/Controls/UIPanel.cs index bbb3f9c2..d04d9797 100644 --- a/SunnyUI/Controls/UIPanel.cs +++ b/SunnyUI/Controls/UIPanel.cs @@ -28,597 +28,22 @@ * 2022-03-19: V3.1.1 重构主题配色 ******************************************************************************/ -using System; using System.ComponentModel; using System.Drawing; -using System.Drawing.Drawing2D; -using System.Windows.Forms; - -// ReSharper disable All -#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 UIPanel : UserControl, IStyleInterface + public partial class UIPanel : UIUserControl { - 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() { InitializeComponent(); - Version = UIGlobal.Version; - AutoScaleMode = AutoScaleMode.None; base.Font = UIFontColor.Font(); base.MinimumSize = new System.Drawing.Size(1, 1); + showText = true; 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(); - } - - /// - /// Tag字符串 - /// - [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(); - } - } - - /// - /// 是否显示圆角 - /// - [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(); - } - } - } - - /// - /// 是否显示边框 - /// - [Description("是否显示边框"), Category("SunnyUI")] - [DefaultValue(true)] - protected bool ShowRect => (int)RectSides > 0; - - /// - /// 边框颜色 - /// - [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); - } - } - - /// - /// 填充颜色,当值为背景色或透明色或空值则不填充 - /// - [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(); - } - } - } - - /// - /// 设置填充颜色 - /// - /// 颜色 - protected void SetFillColor2(Color value) - { - if (fillColor2 != value) - { - fillColor2 = value; - SetStyleCustom(); - } - } - - /// - /// 填充颜色,当值为背景色或透明色或空值则不填充 - /// - [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; - - /// - /// 是否显示填充 - /// - 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) - { - } - - /// - /// 自定义主题风格 - /// - [DefaultValue(false)] - [Description("获取或设置可以自定义主题风格"), Category("SunnyUI")] - public bool StyleCustomMode - { - get; set; - } - - protected UIStyle _style = UIStyle.Blue; - - /// - /// 主题样式 - /// - [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; - } - - /// - /// 设置填充只读颜色 - /// - /// 颜色 - protected void SetFillReadOnlyColor(Color color) - { - fillReadOnlyColor = color; - AfterSetFillReadOnlyColor(color); - SetStyleCustom(); - } - - /// - /// 设置边框只读颜色 - /// - /// 颜色 - protected void SetRectReadOnlyColor(Color color) - { - rectReadOnlyColor = color; - AfterSetRectReadOnlyColor(color); - SetStyleCustom(); - } - - /// - /// 设置字体只读颜色 - /// - /// 颜色 - protected void SetForeReadOnlyColor(Color color) - { - foreReadOnlyColor = color; - AfterSetForeReadOnlyColor(color); - SetStyleCustom(); - } - /// /// 字体颜色 /// @@ -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")] [Description("不可用时字体颜色"), Category("SunnyUI")] public Color ForeDisableColor @@ -659,113 +68,31 @@ namespace Sunny.UI set => SetForeDisableColor(value); } - protected virtual void OnRadiusChanged(int value) + [Description("是否显示文字"), Category("SunnyUI")] + [DefaultValue(true)] + [Browsable(false)] + public bool ShowText { - } - - protected Color foreDisableColor = UIStyles.Blue.ForeDisableColor; - protected Color rectDisableColor = UIStyles.Blue.RectDisableColor; - protected Color fillDisableColor = UIStyles.Blue.FillDisableColor; - /// - /// 字体只读颜色 - /// - protected Color foreReadOnlyColor = UIStyles.Blue.ForeDisableColor; - - /// - /// 边框只读颜色 - /// - protected Color rectReadOnlyColor = UIStyles.Blue.RectDisableColor; - - - /// - /// 填充只读颜色 - /// - 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; - } - - - /// - /// 屏蔽原属性,获取或设置一个值,该值指示是否在 Windows 任务栏中显示窗体。 - /// - /// true if [show in taskbar]; otherwise, false. - [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; - - /// - /// 文字对齐方向 - /// - [Description("文字对齐方向"), Category("SunnyUI")] - public ContentAlignment TextAlignment - { - get => _textAlignment; + get => showText; set { - _textAlignment = value; - TextAlignmentChange?.Invoke(this, value); - Invalidate(); - } - } - - public delegate void OnTextAlignmentChange(object sender, ContentAlignment alignment); - - public event OnTextAlignmentChange TextAlignmentChange; - - private int rectSize = 1; - - /// - /// 边框颜色 - /// - [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) + if (showText != value) { - rectSize = v; + showText = value; Invalidate(); } } } - [Browsable(false)] - public new bool AutoScroll { get; set; } = false; - - protected void SetStyleCustom(bool needRefresh = true) + /// + /// 设置字体只读颜色 + /// + /// 颜色 + protected void SetForeReadOnlyColor(Color color) { - _style = UIStyle.Custom; - if (needRefresh) Invalidate(); + foreReadOnlyColor = color; + AfterSetForeReadOnlyColor(color); + SetStyleCustom(); } } } \ No newline at end of file diff --git a/SunnyUI/Controls/UIUserControl.Designer.cs b/SunnyUI/Controls/UIUserControl.Designer.cs new file mode 100644 index 00000000..aef2edaa --- /dev/null +++ b/SunnyUI/Controls/UIUserControl.Designer.cs @@ -0,0 +1,37 @@ +namespace Sunny.UI +{ + partial class UIUserControl + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + } + + #endregion + } +} diff --git a/SunnyUI/Controls/UIUserControl.cs b/SunnyUI/Controls/UIUserControl.cs new file mode 100644 index 00000000..9afeea6a --- /dev/null +++ b/SunnyUI/Controls/UIUserControl.cs @@ -0,0 +1,714 @@ +/****************************************************************************** + * SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。 + * CopyRight (C) 2012-2022 ShenYongHua(沈永华). + * QQ群:56829229 QQ:17612584 EMail:SunnyUI@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(); + } + + /// + /// Tag字符串 + /// + [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(); + } + } + + /// + /// 是否显示圆角 + /// + [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(); + } + } + } + + /// + /// 是否显示边框 + /// + [Description("是否显示边框"), Category("SunnyUI")] + [DefaultValue(true)] + protected bool ShowRect => (int)RectSides > 0; + + /// + /// 边框颜色 + /// + [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); + } + } + + /// + /// 填充颜色,当值为背景色或透明色或空值则不填充 + /// + [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(); + } + } + } + + /// + /// 设置填充颜色 + /// + /// 颜色 + protected void SetFillColor2(Color value) + { + if (fillColor2 != value) + { + fillColor2 = value; + SetStyleCustom(); + } + } + + /// + /// 填充颜色,当值为背景色或透明色或空值则不填充 + /// + [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; + + /// + /// 是否显示填充 + /// + 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) + { + } + + /// + /// 自定义主题风格 + /// + [DefaultValue(false)] + [Description("获取或设置可以自定义主题风格"), Category("SunnyUI")] + public bool StyleCustomMode + { + get; set; + } + + protected UIStyle _style = UIStyle.Blue; + + /// + /// 主题样式 + /// + [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; + } + + /// + /// 设置填充只读颜色 + /// + /// 颜色 + protected void SetFillReadOnlyColor(Color color) + { + fillReadOnlyColor = color; + AfterSetFillReadOnlyColor(color); + SetStyleCustom(); + } + + /// + /// 设置边框只读颜色 + /// + /// 颜色 + 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; + /// + /// 字体只读颜色 + /// + protected Color foreReadOnlyColor = UIStyles.Blue.ForeDisableColor; + + /// + /// 边框只读颜色 + /// + protected Color rectReadOnlyColor = UIStyles.Blue.RectDisableColor; + + + /// + /// 填充只读颜色 + /// + 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; + } + + /// + /// 屏蔽原属性,获取或设置一个值,该值指示是否在 Windows 任务栏中显示窗体。 + /// + /// true if [show in taskbar]; otherwise, false. + [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; + + /// + /// 文字对齐方向 + /// + [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; + + /// + /// 边框颜色 + /// + [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(); + } + } +} diff --git a/SunnyUI/Forms/UIForm.cs b/SunnyUI/Forms/UIForm.cs index 4971f7d0..cc768a85 100644 --- a/SunnyUI/Forms/UIForm.cs +++ b/SunnyUI/Forms/UIForm.cs @@ -1293,6 +1293,8 @@ namespace Sunny.UI protected override void OnShown(EventArgs e) { base.OnShown(e); + if (AutoScaleMode == AutoScaleMode.Font) AutoScaleMode = AutoScaleMode.None; + CalcSystemBoxPos(); SetRadius(); isShow = true; diff --git a/SunnyUI/Properties/Resources.Designer.cs b/SunnyUI/Properties/Resources.Designer.cs index f1ec3181..a9115aa9 100644 --- a/SunnyUI/Properties/Resources.Designer.cs +++ b/SunnyUI/Properties/Resources.Designer.cs @@ -180,15 +180,6 @@ namespace Sunny.UI.Properties { } } - /// - /// 查找类似 SunnyUI.Net 的本地化字符串。 - /// - internal static string Name { - get { - return ResourceManager.GetString("Name", resourceCulture); - } - } - /// /// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// @@ -199,15 +190,6 @@ namespace Sunny.UI.Properties { } } - /// - /// 查找类似 V3.1.2 的本地化字符串。 - /// - internal static string Version { - get { - return ResourceManager.GetString("Version", resourceCulture); - } - } - /// /// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// diff --git a/SunnyUI/Properties/Resources.resx b/SunnyUI/Properties/Resources.resx index 5c909c82..08535611 100644 --- a/SunnyUI/Properties/Resources.resx +++ b/SunnyUI/Properties/Resources.resx @@ -1,6 +1,6 @@  - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - ..\Resources\close.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\colorbarIndicators.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\gps1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\gps_postion.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\img_notifier.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Login1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Login2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Login3.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Login4.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Login5.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Login6.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\menu.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - SunnyUI.Net - SunnyUI.Net 是基于.Net Framework 4.0+、.Net 5 、.Net 6框架的 C# WinForm 开源控件库、工具类库、扩展类库、多页面开发框架。 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\close.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\notifier.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - V3.1.2 - 2022-03-28 + + ..\Resources\colorbarIndicators.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\gps1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\gps_postion.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\img_notifier.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Login1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Login2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Login3.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Login4.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Login5.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Login6.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\menu.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\notifier.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\wind.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\wind_postion.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\wind.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\wind_postion.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - \ No newline at end of file diff --git a/SunnyUI/Style/UIStyle.cs b/SunnyUI/Style/UIStyle.cs index 1303347c..e80f1452 100644 --- a/SunnyUI/Style/UIStyle.cs +++ b/SunnyUI/Style/UIStyle.cs @@ -814,7 +814,7 @@ namespace Sunny.UI if (obj is UIPage) continue; if (obj is UITableLayoutPanel) continue; if (obj is UIFlowLayoutPanel) continue; - if (obj is UIPanel) continue; + if (obj is UIUserControl) continue; if (obj is TableLayoutPanel) continue; diff --git a/SunnyUI/SunnyUI.csproj b/SunnyUI/SunnyUI.csproj index 158e0216..0877a174 100644 --- a/SunnyUI/SunnyUI.csproj +++ b/SunnyUI/SunnyUI.csproj @@ -1,93 +1,93 @@  - - net5.0-windows;net472;net40 - 9.0 - {AB1CB247-E20B-4CBE-B269-570ADDD96C53} - true - Sunny.UI - SunnyUI.Net 是基于.Net Framework 4.0+、.Net 5、.Net 6 框架的 C# WinForm 开源控件库、工具类库、扩展类库、多页面开发框架。 - CopyRight © SunnyUI.Net 2012-2022 - LICENSE - 3.1.2.1 - ShenYonghua - SunnyUI.Net - SunnyUI - https://gitee.com/yhuse/SunnyUI - https://gitee.com/yhuse/SunnyUI - False - SunnyUI.png - False - D:\MyDocuments\SunnyUI.pfx - False - False - + + net5.0-windows;net472;net40 + 9.0 + {AB1CB247-E20B-4CBE-B269-570ADDD96C53} + true + Sunny.UI + SunnyUI.Net 是基于.Net Framework 4.0+、.Net 5、.Net 6 框架的 C# WinForm 开源控件库、工具类库、扩展类库、多页面开发框架。 + CopyRight © SunnyUI.Net 2012-2022 + LICENSE + 3.1.2.1 + ShenYonghua + SunnyUI.Net + SunnyUI + https://gitee.com/yhuse/SunnyUI + https://gitee.com/yhuse/SunnyUI + False + SunnyUI.png + False + D:\MyDocuments\SunnyUI.pfx + False + False + - - ..\Bin\ - true - - + + ..\Bin\ + true + + - - ..\Bin\ - true - - + + ..\Bin\ + true + + - - false - + + false + - - - True - - - - True - - - + + + True + + + + True + + + - - - - - - - + + + + + + + - - - - - + + + + + - - - - - + + + + + - - - + + + - - - True - True - Resources.resx - - + + + True + True + Resources.resx + + - - - ResXFileCodeGenerator - Resources.Designer.cs - - + + + ResXFileCodeGenerator + Resources.Designer.cs + +