diff --git a/Bin/SunnyUI.dll b/Bin/SunnyUI.dll index 475edc96..b5301ca8 100644 Binary files a/Bin/SunnyUI.dll and b/Bin/SunnyUI.dll differ diff --git a/Bin/SunnyUI.pdb b/Bin/SunnyUI.pdb index 699687f5..22ccb266 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 69e3b3ca..b5354611 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 475edc96..b5301ca8 100644 Binary files a/SunnyUI.Demo/Bin/SunnyUI.dll and b/SunnyUI.Demo/Bin/SunnyUI.dll differ diff --git a/SunnyUI.Demo/Charts/FPieChart.Designer.cs b/SunnyUI.Demo/Charts/FPieChart.Designer.cs index c0f201aa..813776e3 100644 --- a/SunnyUI.Demo/Charts/FPieChart.Designer.cs +++ b/SunnyUI.Demo/Charts/FPieChart.Designer.cs @@ -68,7 +68,7 @@ this.PieChart.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(244)))), ((int)(((byte)(244)))), ((int)(((byte)(244))))); this.PieChart.Font = new System.Drawing.Font("微软雅黑", 12F); this.PieChart.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(54)))), ((int)(((byte)(54)))), ((int)(((byte)(54))))); - this.PieChart.LegendFont = new System.Drawing.Font("微软雅黑", 12F); + this.PieChart.LegendFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.PieChart.Location = new System.Drawing.Point(30, 48); this.PieChart.Name = "PieChart"; this.PieChart.Option = null; diff --git a/SunnyUI.Demo/Controls/FPanel.Designer.cs b/SunnyUI.Demo/Controls/FPanel.Designer.cs index 09e48322..6b8e7700 100644 --- a/SunnyUI.Demo/Controls/FPanel.Designer.cs +++ b/SunnyUI.Demo/Controls/FPanel.Designer.cs @@ -31,11 +31,13 @@ this.uiTitlePanel1 = new Sunny.UI.UITitlePanel(); this.uiPanel1 = new Sunny.UI.UIPanel(); this.uiGroupBox1 = new Sunny.UI.UIGroupBox(); + this.uiTitlePanel2 = new Sunny.UI.UITitlePanel(); this.PagePanel.SuspendLayout(); this.SuspendLayout(); // // PagePanel // + this.PagePanel.Controls.Add(this.uiTitlePanel2); this.PagePanel.Controls.Add(this.uiGroupBox1); this.PagePanel.Controls.Add(this.uiPanel1); this.PagePanel.Controls.Add(this.uiTitlePanel1); @@ -74,6 +76,19 @@ this.uiGroupBox1.TabIndex = 4; this.uiGroupBox1.Text = "uiGroupBox1"; // + // uiTitlePanel2 + // + this.uiTitlePanel2.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiTitlePanel2.ForeColor = System.Drawing.Color.White; + this.uiTitlePanel2.Location = new System.Drawing.Point(331, 230); + this.uiTitlePanel2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.uiTitlePanel2.Name = "uiTitlePanel2"; + this.uiTitlePanel2.Padding = new System.Windows.Forms.Padding(0, 35, 0, 0); + this.uiTitlePanel2.ShowCollapse = true; + this.uiTitlePanel2.Size = new System.Drawing.Size(270, 180); + this.uiTitlePanel2.TabIndex = 5; + this.uiTitlePanel2.Text = "uiTitlePanel2"; + // // FPanel // this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F); @@ -91,5 +106,6 @@ private UITitlePanel uiTitlePanel1; private UIPanel uiPanel1; private UIGroupBox uiGroupBox1; + private UITitlePanel uiTitlePanel2; } } \ No newline at end of file diff --git a/SunnyUI/Charts/UIBarChartOption.cs b/SunnyUI/Charts/UIBarChartOption.cs index dbc9f6b2..f18d0c55 100644 --- a/SunnyUI/Charts/UIBarChartOption.cs +++ b/SunnyUI/Charts/UIBarChartOption.cs @@ -201,5 +201,16 @@ namespace Sunny.UI public delegate Color OnDataColorChangeEventHandler(double data); public event OnDataColorChangeEventHandler DataColorChange; + + public bool HaveCustomColor(int index) + { + return Colors.Count > 0 && index >= 0 && index < Colors.Count; + } + + public void Clear() + { + Data.Clear(); + Colors.Clear(); + } } } \ No newline at end of file diff --git a/SunnyUI/Charts/UIOption.cs b/SunnyUI/Charts/UIOption.cs index 516d5b9d..e88d4619 100644 --- a/SunnyUI/Charts/UIOption.cs +++ b/SunnyUI/Charts/UIOption.cs @@ -60,10 +60,22 @@ namespace Sunny.UI Data.Add(data); } - public void AddColor(Color color) + public void AddData(string data, Color color) { + Data.Add(data); Colors.Add(color); } + + public bool HaveCustomColor(int index) + { + return Colors.Count > 0 && index >= 0 && index < Colors.Count; + } + + public void Clear() + { + Data.Clear(); + Colors.Clear(); + } } public class UIChartGrid diff --git a/SunnyUI/Charts/UIPieChartOption.cs b/SunnyUI/Charts/UIPieChartOption.cs index 062311e4..88a894c4 100644 --- a/SunnyUI/Charts/UIPieChartOption.cs +++ b/SunnyUI/Charts/UIPieChartOption.cs @@ -83,8 +83,8 @@ namespace Sunny.UI { if (DataColorChange != null) { - Color color = DataColorChange.Invoke(value); - Data.Add(new UIPieSeriesData(name, value,color)); + Color color = DataColorChange.Invoke(value); + Data.Add(new UIPieSeriesData(name, value, color)); } else { @@ -149,7 +149,7 @@ namespace Sunny.UI public Color Color { get; set; } - public bool StyleCustomMode { get; set; } + public bool StyleCustomMode { get; private set; } public UIPieSeriesData() { @@ -159,6 +159,7 @@ namespace Sunny.UI { Name = name; Value = value; + StyleCustomMode = false; } public UIPieSeriesData(string name, double value, Color color) diff --git a/SunnyUI/Controls/UITitlePanel.cs b/SunnyUI/Controls/UITitlePanel.cs index 0815b200..c0cb4990 100644 --- a/SunnyUI/Controls/UITitlePanel.cs +++ b/SunnyUI/Controls/UITitlePanel.cs @@ -20,6 +20,7 @@ * 2020-04-25: V2.2.4 更新主题配置类 ******************************************************************************/ +using System; using System.ComponentModel; using System.Drawing; using System.Drawing.Drawing2D; @@ -40,15 +41,27 @@ namespace Sunny.UI { _titleHeight = value; Padding = new Padding(0, value, 0, 0); + CalcSystemBoxPos(); Invalidate(); } } + protected override void OnControlAdded(ControlEventArgs e) + { + base.OnControlAdded(e); + + if (e.Control.Top < TitleHeight) + { + e.Control.Top = TitleHeight + 1; + } + } + public UITitlePanel() { InitializeComponent(); ShowText = false; foreColor = Color.White; + CalcSystemBoxPos(); } public override void SetStyleColor(UIBaseStyle uiColor) @@ -119,6 +132,39 @@ namespace Sunny.UI g.DrawString(Text, Font, color, Width - _titleInterval - sf.Width, (TitleHeight - sf.Height) / 2.0f); break; } + + if (ShowCollapse) + { + if (InControlBox) + { + if (ShowRadius) + g.FillRoundRectangle(UIStyles.ActiveStyleColor.ButtonFillHoverColor, ControlBoxRect, 5); + else + g.FillRectangle(UIStyles.ActiveStyleColor.ButtonFillHoverColor, ControlBoxRect); + } + + g.DrawFontImage(Collapsed ? 61703 : 61702, 24, color, + new Rectangle(ControlBoxRect.Left + 2, ControlBoxRect.Top, ControlBoxRect.Width, ControlBoxRect.Height)); + } + } + + private bool InControlBox; + + protected override void OnMouseMove(MouseEventArgs e) + { + bool inControlBox = e.Location.InRect(ControlBoxRect); + if (inControlBox != InControlBox) + { + InControlBox = inControlBox; + if (ShowCollapse) Invalidate(); + } + } + + protected override void OnMouseLeave(EventArgs e) + { + base.OnMouseLeave(e); + InControlBox = false; + Invalidate(); } private int _titleInterval = 10; @@ -163,5 +209,59 @@ namespace Sunny.UI return graphicsPath; } + + private Rectangle ControlBoxRect; + + private void CalcSystemBoxPos() + { + ControlBoxRect = new Rectangle(Width - 6 - 28, TitleHeight / 2 - 14, 28, 28); + } + + private bool showCollapse; + + [Description("是否打开缩放按钮"), Category("SunnyUI"), DefaultValue(false)] + public bool ShowCollapse + { + get => showCollapse; + set + { + showCollapse = value; + Invalidate(); + } + } + + private bool collapsed; + private int rowHeight = 180; + + [Description("是否缩放"), Category("SunnyUI"), DefaultValue(false)] + public bool Collapsed + { + get => collapsed; + set + { + if (value) + { + rowHeight = Height; + Height = TitleHeight; + } + else + { + Height = rowHeight; + } + + collapsed = value; + Invalidate(); + } + } + + protected override void OnMouseClick(MouseEventArgs e) + { + base.OnMouseClick(e); + + if (ShowCollapse && e.Location.InRect(ControlBoxRect)) + { + Collapsed = !Collapsed; + } + } } } \ No newline at end of file diff --git a/SunnyUI/Forms/UILoginForm.Designer.cs b/SunnyUI/Forms/UILoginForm.Designer.cs index 29b2e69f..c95ee52b 100644 --- a/SunnyUI/Forms/UILoginForm.Designer.cs +++ b/SunnyUI/Forms/UILoginForm.Designer.cs @@ -110,6 +110,7 @@ this.btnCancel.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80))))); this.btnCancel.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(127)))), ((int)(((byte)(128))))); this.btnCancel.FillPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(202)))), ((int)(((byte)(87)))), ((int)(((byte)(89))))); + this.btnCancel.FillSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(202)))), ((int)(((byte)(87)))), ((int)(((byte)(89))))); this.btnCancel.Font = new System.Drawing.Font("微软雅黑", 12F); this.btnCancel.Location = new System.Drawing.Point(533, 326); this.btnCancel.Name = "btnCancel"; @@ -117,9 +118,11 @@ this.btnCancel.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80))))); this.btnCancel.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(127)))), ((int)(((byte)(128))))); this.btnCancel.RectPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(202)))), ((int)(((byte)(87)))), ((int)(((byte)(89))))); + this.btnCancel.RectSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(202)))), ((int)(((byte)(87)))), ((int)(((byte)(89))))); this.btnCancel.Size = new System.Drawing.Size(86, 29); this.btnCancel.Style = Sunny.UI.UIStyle.Red; this.btnCancel.StyleCustomMode = true; + this.btnCancel.Symbol = 61453; this.btnCancel.TabIndex = 3; this.btnCancel.Text = "取消"; this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); diff --git a/SunnyUI/Forms/UILoginForm.resx b/SunnyUI/Forms/UILoginForm.resx new file mode 100644 index 00000000..1af7de15 --- /dev/null +++ b/SunnyUI/Forms/UILoginForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file diff --git a/SunnyUI/SunnyUI.csproj b/SunnyUI/SunnyUI.csproj index 6a5f27d7..e5bd43b2 100644 --- a/SunnyUI/SunnyUI.csproj +++ b/SunnyUI/SunnyUI.csproj @@ -496,6 +496,9 @@ UIForm.cs + + UILoginForm.cs + UINotifier.cs