diff --git a/Bin/SunnyUI.dll b/Bin/SunnyUI.dll
index 3bec3661..a6c599bf 100644
Binary files a/Bin/SunnyUI.dll and b/Bin/SunnyUI.dll differ
diff --git a/Bin/SunnyUI.pdb b/Bin/SunnyUI.pdb
index 4db4cf6a..7a8ad9e5 100644
Binary files a/Bin/SunnyUI.pdb and b/Bin/SunnyUI.pdb differ
diff --git a/SunnyUI.Demo/Bin/SunnyUI.dll b/SunnyUI.Demo/Bin/SunnyUI.dll
index 3bec3661..a6c599bf 100644
Binary files a/SunnyUI.Demo/Bin/SunnyUI.dll and b/SunnyUI.Demo/Bin/SunnyUI.dll differ
diff --git a/SunnyUI/Pages/UIPage.cs b/SunnyUI/Pages/UIPage.cs
index 9137cc10..99a821ac 100644
--- a/SunnyUI/Pages/UIPage.cs
+++ b/SunnyUI/Pages/UIPage.cs
@@ -21,6 +21,7 @@
using System;
using System.ComponentModel;
+using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;
@@ -29,48 +30,103 @@ namespace Sunny.UI
[DefaultEvent("Initialize")]
public partial class UIPage : Form, IStyleInterface
{
- public event EventHandler Initialize;
+ public readonly Guid Guid = Guid.NewGuid();
+ private Color _rectColor = UIColor.Blue;
+
+ private ToolStripStatusLabelBorderSides _rectSides = ToolStripStatusLabelBorderSides.None;
+
+ protected UIStyle _style = UIStyle.Blue;
+
+ public UIStatusForm StatusForm;
public UIPage()
{
InitializeComponent();
base.BackColor = UIColor.LightBlue;
-
- if (this.Register())
- {
- SetStyle(UIStyles.Style);
- }
+ TopLevel = false;
+ if (this.Register()) SetStyle(UIStyles.Style);
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.DoubleBuffer, true);
UpdateStyles();
- if (!IsDesignMode)
- {
- base.Dock = DockStyle.Fill;
- }
+ if (!IsDesignMode) base.Dock = DockStyle.Fill;
Version = UIGlobal.Version;
}
- public UIStatusForm StatusForm;
+ [Browsable(false)] public Point ParentLocation { get; set; } = new Point(0, 0);
+
+ public int PageIndex { get; set; } = -1;
+
+ ///
+ /// 边框颜色
+ ///
+ /// The color of the border style.
+ [Description("边框颜色")]
+ public Color RectColor
+ {
+ get => _rectColor;
+ set
+ {
+ _rectColor = value;
+ AfterSetRectColor(value);
+ _style = UIStyle.Custom;
+ Invalidate();
+ }
+ }
+
+ protected bool IsDesignMode
+ {
+ get
+ {
+ var ReturnFlag = false;
+ if (LicenseManager.UsageMode == LicenseUsageMode.Designtime)
+ ReturnFlag = true;
+ else if (Process.GetCurrentProcess().ProcessName == "devenv")
+ ReturnFlag = true;
+
+ return ReturnFlag;
+ }
+ }
+
+ [DefaultValue(ToolStripStatusLabelBorderSides.None)]
+ [Description("边框显示位置")]
+ public ToolStripStatusLabelBorderSides RectSides
+ {
+ get => _rectSides;
+ set
+ {
+ _rectSides = value;
+ Invalidate();
+ }
+ }
+
+ [DefaultValue(null)] public string TagString { get; set; }
+
+ public string Version { get; }
+
+ [DefaultValue(UIStyle.Blue)]
+ public UIStyle Style
+ {
+ get => _style;
+ set => SetStyle(value);
+ }
+
+ [DefaultValue(false)] public bool StyleCustomMode { get; set; }
+
+ public event EventHandler Initialize;
public void ShowStatus(string title, string desc, int max = 100, int value = 0)
{
- if (StatusForm == null)
- {
- StatusForm = new UIStatusForm();
- }
+ if (StatusForm == null) StatusForm = new UIStatusForm();
StatusForm.Style = Style;
StatusForm.Show(title, desc, max, value);
}
- [Browsable(false)]
- public Point ParentLocation { get; set; } = new Point(0, 0);
-
public void HideStatus()
{
StatusForm.Hide();
@@ -86,21 +142,10 @@ namespace Sunny.UI
base.OnControlAdded(e);
if (e.Control is IStyleInterface ctrl)
- {
if (!ctrl.StyleCustomMode)
- {
ctrl.Style = Style;
- }
- }
}
- public int PageIndex { get; set; } = -1;
-
- [DefaultValue(null)]
- public string TagString { get; set; }
-
- public string Version { get; }
-
public virtual void Init()
{
Initialize?.Invoke(this, null);
@@ -110,16 +155,6 @@ namespace Sunny.UI
{
}
- protected UIStyle _style = UIStyle.Blue;
- private Color _rectColor = UIColor.Blue;
-
- [DefaultValue(UIStyle.Blue)]
- public UIStyle Style
- {
- get => _style;
- set => SetStyle(value);
- }
-
public void SetStyle(UIStyle style)
{
this.SetChildUIStyle(style);
@@ -138,26 +173,6 @@ namespace Sunny.UI
Invalidate();
}
- [DefaultValue(false)]
- public bool StyleCustomMode { get; set; }
-
- ///
- /// 边框颜色
- ///
- /// The color of the border style.
- [Description("边框颜色")]
- public Color RectColor
- {
- get => _rectColor;
- set
- {
- _rectColor = value;
- AfterSetRectColor(value);
- _style = UIStyle.Custom;
- Invalidate();
- }
- }
-
protected virtual void AfterSetFillColor(Color color)
{
}
@@ -170,30 +185,11 @@ namespace Sunny.UI
{
}
- protected bool IsDesignMode
- {
- get
- {
- bool ReturnFlag = false;
- if (LicenseManager.UsageMode == LicenseUsageMode.Designtime)
- ReturnFlag = true;
- else if (System.Diagnostics.Process.GetCurrentProcess().ProcessName == "devenv")
- ReturnFlag = true;
-
- return ReturnFlag;
- }
- }
-
- public readonly Guid Guid = Guid.NewGuid();
-
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
- if (Width <= 0 || Height <= 0)
- {
- return;
- }
+ if (Width <= 0 || Height <= 0) return;
if (RectSides != ToolStripStatusLabelBorderSides.None)
{
@@ -208,19 +204,6 @@ namespace Sunny.UI
}
}
- private ToolStripStatusLabelBorderSides _rectSides = ToolStripStatusLabelBorderSides.None;
-
- [DefaultValue(ToolStripStatusLabelBorderSides.None), Description("边框显示位置")]
- public ToolStripStatusLabelBorderSides RectSides
- {
- get => _rectSides;
- set
- {
- _rectSides = value;
- Invalidate();
- }
- }
-
protected override void OnBackColorChanged(EventArgs e)
{
base.OnBackColorChanged(e);
@@ -237,7 +220,7 @@ namespace Sunny.UI
private void UIPage_Shown(object sender, EventArgs e)
{
- SetStyle(UIStyles.Style);
+ //SetStyle(UIStyles.Style);
}
}
}
\ No newline at end of file