diff --git a/Bin/SunnyUI.dll b/Bin/SunnyUI.dll index cff5c3e1..be1e0199 100644 Binary files a/Bin/SunnyUI.dll and b/Bin/SunnyUI.dll differ diff --git a/Bin/SunnyUI.pdb b/Bin/SunnyUI.pdb index b9954b81..691c20d1 100644 Binary files a/Bin/SunnyUI.pdb and b/Bin/SunnyUI.pdb differ diff --git a/SunnyUI.Demo/Bin/SunnyUI.Demo.exe b/SunnyUI.Demo/Bin/SunnyUI.Demo.exe index a81d6df0..5d596ad9 100644 Binary files a/SunnyUI.Demo/Bin/SunnyUI.Demo.exe and b/SunnyUI.Demo/Bin/SunnyUI.Demo.exe differ diff --git a/SunnyUI.Demo/Bin/SunnyUI.dll b/SunnyUI.Demo/Bin/SunnyUI.dll index cff5c3e1..be1e0199 100644 Binary files a/SunnyUI.Demo/Bin/SunnyUI.dll and b/SunnyUI.Demo/Bin/SunnyUI.dll differ diff --git a/SunnyUI.Demo/FMain.Designer.cs b/SunnyUI.Demo/FMain.Designer.cs index 7731f86d..a7e412b4 100644 --- a/SunnyUI.Demo/FMain.Designer.cs +++ b/SunnyUI.Demo/FMain.Designer.cs @@ -105,6 +105,7 @@ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1024, 720); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MinimumSize = new System.Drawing.Size(1024, 720); this.Name = "FMain"; this.Padding = new System.Windows.Forms.Padding(2, 35, 2, 2); this.ShowDragStretch = true; diff --git a/SunnyUI/Controls/DropItem/UIDropControl.cs b/SunnyUI/Controls/DropItem/UIDropControl.cs index a2f14e3c..ca1fceee 100644 --- a/SunnyUI/Controls/DropItem/UIDropControl.cs +++ b/SunnyUI/Controls/DropItem/UIDropControl.cs @@ -81,6 +81,7 @@ namespace Sunny.UI public new event KeyPressEventHandler KeyPress; + [Browsable(true)] public new event EventHandler TextChanged; private void EditOnKeyPress(object sender, KeyPressEventArgs e) diff --git a/SunnyUI/Controls/DropItem/UIDropDown.cs b/SunnyUI/Controls/DropItem/UIDropDown.cs index 06ecec37..abcf1581 100644 --- a/SunnyUI/Controls/DropItem/UIDropDown.cs +++ b/SunnyUI/Controls/DropItem/UIDropDown.cs @@ -92,7 +92,7 @@ namespace Sunny.UI InitializeComponent(); AutoSize = false; DoubleBuffered = true; - ResizeRedraw = true; + //ResizeRedraw = true; ToolStripControlHost _host = new ToolStripControlHost(item); Padding = Margin = _host.Padding = _host.Margin = Padding.Empty; item.MinimumSize = item.Size; diff --git a/SunnyUI/Controls/TypeEditor/UIRadiusSidesEditor.cs b/SunnyUI/Controls/TypeEditor/UIRadiusSidesEditor.cs index d85a2c1d..7f2640d9 100644 --- a/SunnyUI/Controls/TypeEditor/UIRadiusSidesEditor.cs +++ b/SunnyUI/Controls/TypeEditor/UIRadiusSidesEditor.cs @@ -115,7 +115,6 @@ namespace Sunny.UI /// 数值 protected override void InitValue(object value) { - Console.WriteLine(value.ToString()); UICornerRadiusSides sides = (UICornerRadiusSides)value; ResetCheckBoxState(); if ((sides & UICornerRadiusSides.All) == UICornerRadiusSides.All) diff --git a/SunnyUI/Controls/UIControl.cs b/SunnyUI/Controls/UIControl.cs index 5fab924a..c2190bba 100644 --- a/SunnyUI/Controls/UIControl.cs +++ b/SunnyUI/Controls/UIControl.cs @@ -39,7 +39,12 @@ namespace Sunny.UI /// public UIControl() { - SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer | ControlStyles.DoubleBuffer, true); + SetStyle(ControlStyles.AllPaintingInWmPaint, true); + SetStyle(ControlStyles.DoubleBuffer, true); + SetStyle(ControlStyles.Selectable, true); + SetStyle(ControlStyles.SupportsTransparentBackColor, true); + SetStyle(ControlStyles.UserPaint, true); + SetStyle(ControlStyles.OptimizedDoubleBuffer, true); base.DoubleBuffered = true; UpdateStyles(); diff --git a/SunnyUI/Controls/UINavBar.cs b/SunnyUI/Controls/UINavBar.cs index 656c55b6..72bacf68 100644 --- a/SunnyUI/Controls/UINavBar.cs +++ b/SunnyUI/Controls/UINavBar.cs @@ -41,11 +41,10 @@ namespace Sunny.UI SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.DoubleBuffer, true); - SetStyle(ControlStyles.ResizeRedraw, true); - SetStyle(ControlStyles.Selectable, true); SetStyle(ControlStyles.SupportsTransparentBackColor, true); SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.OptimizedDoubleBuffer, true); + SetStyle(ControlStyles.ResizeRedraw, true); DoubleBuffered = true; UpdateStyles(); Font = UIFontColor.Font; @@ -57,6 +56,12 @@ namespace Sunny.UI Version = UIGlobal.Version; } + protected override void OnFontChanged(EventArgs e) + { + base.OnFontChanged(e); + if (NavBarMenu != null) NavBarMenu.Font = Font; + } + [DefaultValue(null)] [Description("关联的TabControl"), Category("SunnyUI")] public UITabControl TabControl { get; set; } diff --git a/SunnyUI/Controls/UIPanel.cs b/SunnyUI/Controls/UIPanel.cs index fed73d6e..80bb9544 100644 --- a/SunnyUI/Controls/UIPanel.cs +++ b/SunnyUI/Controls/UIPanel.cs @@ -44,9 +44,9 @@ namespace Sunny.UI public UIPanel() { InitializeComponent(); + SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.DoubleBuffer, true); - SetStyle(ControlStyles.ResizeRedraw, true); SetStyle(ControlStyles.Selectable, true); SetStyle(ControlStyles.SupportsTransparentBackColor, true); SetStyle(ControlStyles.UserPaint, true); @@ -55,6 +55,7 @@ namespace Sunny.UI UpdateStyles(); Version = UIGlobal.Version; + AutoScaleMode = AutoScaleMode.None; base.Font = UIFontColor.Font; base.MinimumSize = new System.Drawing.Size(1, 1); } diff --git a/SunnyUI/Controls/UIRichTextBox.cs b/SunnyUI/Controls/UIRichTextBox.cs index 7c1de46e..4d6db965 100644 --- a/SunnyUI/Controls/UIRichTextBox.cs +++ b/SunnyUI/Controls/UIRichTextBox.cs @@ -46,20 +46,13 @@ namespace Sunny.UI edit.ScrollBars = RichTextBoxScrollBars.Vertical; } - private bool showScrollBar = true; + protected override void OnFontChanged(EventArgs e) + { + base.OnFontChanged(e); + if (edit != null) edit.Font = Font; + } - // [DefaultValue(true)] - // public bool ShowScrollBar - // { - // get => showScrollBar; - // set - // { - // showScrollBar = value; - // bar.Visible = value; - // edit.ScrollBars = value ? RichTextBoxScrollBars.Vertical : RichTextBoxScrollBars.None; - // SetScrollInfo(); - // } - // } + private bool showScrollBar = true; [DefaultValue(false)] [Description("是否只读"), Category("SunnyUI")] diff --git a/SunnyUI/Controls/UISwitch.cs b/SunnyUI/Controls/UISwitch.cs index e667f3d5..3a4a4051 100644 --- a/SunnyUI/Controls/UISwitch.cs +++ b/SunnyUI/Controls/UISwitch.cs @@ -34,6 +34,12 @@ namespace Sunny.UI { public delegate void OnValueChanged(object sender, bool value); + public enum UISwitchShape + { + Round, + Square + } + public UISwitch() { Height = 29; @@ -45,6 +51,20 @@ namespace Sunny.UI fillColor = Color.White; } + public UISwitchShape switchShape = UISwitchShape.Round; + + [Description("开关形状"), Category("SunnyUI")] + [DefaultValue(UISwitchShape.Round)] + public UISwitchShape SwitchShape + { + get => switchShape; + set + { + switchShape = value; + Invalidate(); + } + } + public event OnValueChanged ValueChanged; /// @@ -169,7 +189,7 @@ namespace Sunny.UI protected override void OnPaintFill(Graphics g, GraphicsPath path) { - Width = (int)(Height * 2.6); + //Width = (int)(Height * 2.6); Rectangle rect = new Rectangle(0, 0, Width - 1, Height - 1); g.FillRoundRectangle(Active ? ActiveColor : InActiveColor, rect, rect.Height); diff --git a/SunnyUI/Controls/UITabControl.cs b/SunnyUI/Controls/UITabControl.cs index 1623f77b..af312351 100644 --- a/SunnyUI/Controls/UITabControl.cs +++ b/SunnyUI/Controls/UITabControl.cs @@ -39,7 +39,7 @@ namespace Sunny.UI public UITabControl() { - SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.DoubleBuffer, true); + SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.DoubleBuffer, true); ItemSize = new Size(150, 40); DrawMode = TabDrawMode.OwnerDrawFixed; diff --git a/SunnyUI/Controls/UITabControlMenu.cs b/SunnyUI/Controls/UITabControlMenu.cs index 88b52ade..723e1766 100644 --- a/SunnyUI/Controls/UITabControlMenu.cs +++ b/SunnyUI/Controls/UITabControlMenu.cs @@ -31,7 +31,7 @@ namespace Sunny.UI { public UITabControlMenu() { - SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.DoubleBuffer, true); + SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.DoubleBuffer, true); ItemSize = new Size(40, 200); DrawMode = TabDrawMode.OwnerDrawFixed; diff --git a/SunnyUI/Forms/UIForm.cs b/SunnyUI/Forms/UIForm.cs index f6b66d68..555ddad2 100644 --- a/SunnyUI/Forms/UIForm.cs +++ b/SunnyUI/Forms/UIForm.cs @@ -55,14 +55,12 @@ namespace Sunny.UI ControlStyles.DoubleBuffer | ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | - //ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor, true); UpdateStyles(); Version = UIGlobal.Version; FormBorderStyle = FormBorderStyle.None; m_aeroEnabled = false; - base.MaximumSize = ShowFullScreen ? Screen.PrimaryScreen.Bounds.Size : Screen.PrimaryScreen.WorkingArea.Size; } //不显示FormBorderStyle属性 @@ -72,11 +70,7 @@ namespace Sunny.UI public new FormBorderStyle FormBorderStyle { get { return base.FormBorderStyle; } - set - { - base.FormBorderStyle = FormBorderStyle.None; - Console.WriteLine(value); - } + set { base.FormBorderStyle = FormBorderStyle.None; } } public void Render() @@ -281,11 +275,21 @@ namespace Sunny.UI { } + private bool showFullScreen; + /// /// 是否以全屏模式进入最大化 /// [Description("是否以全屏模式进入最大化"), Category("WindowStyle"), DefaultValue(false)] - public bool ShowFullScreen { get; set; } + public bool ShowFullScreen + { + get => showFullScreen; + set + { + showFullScreen = value; + base.MaximumSize = ShowFullScreen ? Screen.PrimaryScreen.Bounds.Size : Screen.PrimaryScreen.WorkingArea.Size; + } + } /// /// 标题栏高度 @@ -1019,7 +1023,6 @@ namespace Sunny.UI protected override void OnShown(EventArgs e) { base.OnShown(e); - CalcSystemBoxPos(); SetRadius(); isShow = true;