diff --git a/Bin/net40/SunnyUI.Demo.exe b/Bin/net40/SunnyUI.Demo.exe index d74bfdaa..17164944 100644 Binary files a/Bin/net40/SunnyUI.Demo.exe and b/Bin/net40/SunnyUI.Demo.exe differ diff --git a/Bin/net40/SunnyUI.dll b/Bin/net40/SunnyUI.dll index c7c0d8c5..bb4d4cac 100644 Binary files a/Bin/net40/SunnyUI.dll and b/Bin/net40/SunnyUI.dll differ diff --git a/Bin/net45/SunnyUI.dll b/Bin/net45/SunnyUI.dll index 72d1404a..06a23df0 100644 Binary files a/Bin/net45/SunnyUI.dll and b/Bin/net45/SunnyUI.dll differ diff --git a/Bin/net5.0-windows/SunnyUI.dll b/Bin/net5.0-windows/SunnyUI.dll index 6d965ca1..3c347e9a 100644 Binary files a/Bin/net5.0-windows/SunnyUI.dll and b/Bin/net5.0-windows/SunnyUI.dll differ diff --git a/Bin/net5.0-windows/ref/SunnyUI.dll b/Bin/net5.0-windows/ref/SunnyUI.dll index fcc01dfd..7112f688 100644 Binary files a/Bin/net5.0-windows/ref/SunnyUI.dll and b/Bin/net5.0-windows/ref/SunnyUI.dll differ diff --git a/Bin/netcoreapp3.1/SunnyUI.dll b/Bin/netcoreapp3.1/SunnyUI.dll index bc99191e..a2c0ddeb 100644 Binary files a/Bin/netcoreapp3.1/SunnyUI.dll and b/Bin/netcoreapp3.1/SunnyUI.dll differ diff --git a/SunnyUI.Demo/Charts/FBarChart.Designer.cs b/SunnyUI.Demo/Charts/FBarChart.Designer.cs index 5c76016c..03865c0d 100644 --- a/SunnyUI.Demo/Charts/FBarChart.Designer.cs +++ b/SunnyUI.Demo/Charts/FBarChart.Designer.cs @@ -117,6 +117,7 @@ namespace Sunny.UI.Demo this.BarChart.MinimumSize = new System.Drawing.Size(1, 1); this.BarChart.Name = "BarChart"; this.BarChart.Size = new System.Drawing.Size(670, 400); + this.BarChart.Style = Sunny.UI.UIStyle.Custom; this.BarChart.TabIndex = 29; this.BarChart.Text = "uiBarChart1"; // diff --git a/SunnyUI.Demo/Charts/FBarChart.cs b/SunnyUI.Demo/Charts/FBarChart.cs index 905eaf9e..470ccd27 100644 --- a/SunnyUI.Demo/Charts/FBarChart.cs +++ b/SunnyUI.Demo/Charts/FBarChart.cs @@ -1,4 +1,5 @@ using System; +using System.Drawing; namespace Sunny.UI.Demo { @@ -62,9 +63,13 @@ namespace Sunny.UI.Demo option.XAxis.Name = "日期"; option.YAxis.Name = "数值"; + option.YAxis.AxisLabel.DecimalCount = 1; + option.YAxis.AxisLabel.AutoFormat = false; - //option.YAxisScaleLines.Add(new UIScaleLine() { Color = Color.Red, Name = "上限", Value = 12 }); - //option.YAxisScaleLines.Add(new UIScaleLine() { Color = Color.Gold, Name = "下限", Value = -20 }); + option.YAxisScaleLines.Add(new UIScaleLine() { Color = Color.Red, Name = "上限", Value = 12 }); + option.YAxisScaleLines.Add(new UIScaleLine() { Color = Color.Gold, Name = "下限", Value = -20 }); + + option.ToolTip.AxisPointer.Type = UIAxisPointerType.Shadow; BarChart.SetOption(option); diff --git a/SunnyUI.Demo/FColorful.Designer.cs b/SunnyUI.Demo/Forms/FColorful.Designer.cs similarity index 99% rename from SunnyUI.Demo/FColorful.Designer.cs rename to SunnyUI.Demo/Forms/FColorful.Designer.cs index 805bee35..29b5e4bc 100644 --- a/SunnyUI.Demo/FColorful.Designer.cs +++ b/SunnyUI.Demo/Forms/FColorful.Designer.cs @@ -266,7 +266,7 @@ namespace Sunny.UI.Demo // this.AllowShowTitle = true; this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.ClientSize = new System.Drawing.Size(776, 543); this.Controls.Add(this.uiLabel2); this.Controls.Add(this.uiPanel11); diff --git a/SunnyUI.Demo/FColorful.cs b/SunnyUI.Demo/Forms/FColorful.cs similarity index 100% rename from SunnyUI.Demo/FColorful.cs rename to SunnyUI.Demo/Forms/FColorful.cs diff --git a/SunnyUI.Demo/FColorful.resx b/SunnyUI.Demo/Forms/FColorful.resx similarity index 100% rename from SunnyUI.Demo/FColorful.resx rename to SunnyUI.Demo/Forms/FColorful.resx diff --git a/SunnyUI.Demo/SunnyUI.Demo.csproj b/SunnyUI.Demo/SunnyUI.Demo.csproj index 18da7b49..ad6083f2 100644 --- a/SunnyUI.Demo/SunnyUI.Demo.csproj +++ b/SunnyUI.Demo/SunnyUI.Demo.csproj @@ -335,10 +335,10 @@ - + Form - + FColorful.cs @@ -489,7 +489,7 @@ Resources.resx True - + FColorful.cs diff --git a/SunnyUI/Charts/UIBarChart.cs b/SunnyUI/Charts/UIBarChart.cs index 8cce26c2..2d131746 100644 --- a/SunnyUI/Charts/UIBarChart.cs +++ b/SunnyUI/Charts/UIBarChart.cs @@ -445,10 +445,10 @@ namespace Sunny.UI protected virtual void DrawAxis(Graphics g) { - if (YAxisStart >= 0) g.DrawLine(ChartStyle.ForeColor, DrawOrigin, new Point(DrawOrigin.X + DrawSize.Width, DrawOrigin.Y)); - if (YAxisEnd <= 0) g.DrawLine(ChartStyle.ForeColor, new Point(DrawOrigin.X, Option.Grid.Top), new Point(DrawOrigin.X + DrawSize.Width, Option.Grid.Top)); + if (YAxisStart >= 0) g.DrawLine(ForeColor, DrawOrigin, new Point(DrawOrigin.X + DrawSize.Width, DrawOrigin.Y)); + if (YAxisEnd <= 0) g.DrawLine(ForeColor, new Point(DrawOrigin.X, Option.Grid.Top), new Point(DrawOrigin.X + DrawSize.Width, Option.Grid.Top)); - g.DrawLine(ChartStyle.ForeColor, DrawOrigin, new Point(DrawOrigin.X, DrawOrigin.Y - DrawSize.Height)); + g.DrawLine(ForeColor, DrawOrigin, new Point(DrawOrigin.X, DrawOrigin.Y - DrawSize.Height)); if (Option.XAxis.AxisTick.Show) { @@ -459,7 +459,7 @@ namespace Sunny.UI start = DrawOrigin.X + DrawBarWidth / 2.0f; for (int i = 0; i < Option.XAxis.Data.Count; i++) { - g.DrawLine(ChartStyle.ForeColor, start, DrawOrigin.Y, start, DrawOrigin.Y + Option.XAxis.AxisTick.Length); + g.DrawLine(ForeColor, start, DrawOrigin.Y, start, DrawOrigin.Y + Option.XAxis.AxisTick.Length); start += DrawBarWidth; } } @@ -480,7 +480,7 @@ namespace Sunny.UI start = DrawOrigin.X; for (int i = 0; i <= Option.XAxis.Data.Count; i++) { - g.DrawLine(ChartStyle.ForeColor, start, DrawOrigin.Y, start, DrawOrigin.Y + Option.XAxis.AxisTick.Length); + g.DrawLine(ForeColor, start, DrawOrigin.Y, start, DrawOrigin.Y + Option.XAxis.AxisTick.Length); start += DrawBarWidth; } } @@ -493,12 +493,12 @@ namespace Sunny.UI foreach (var data in Option.XAxis.Data) { SizeF sf = g.MeasureString(data, SubFont); - g.DrawString(data, SubFont, ChartStyle.ForeColor, start - sf.Width / 2.0f, DrawOrigin.Y + Option.XAxis.AxisTick.Length); + g.DrawString(data, SubFont, ForeColor, start - sf.Width / 2.0f, DrawOrigin.Y + Option.XAxis.AxisTick.Length); start += DrawBarWidth; } SizeF sfname = g.MeasureString(Option.XAxis.Name, SubFont); - g.DrawString(Option.XAxis.Name, SubFont, ChartStyle.ForeColor, DrawOrigin.X + (DrawSize.Width - sfname.Width) / 2.0f, DrawOrigin.Y + Option.XAxis.AxisTick.Length + sfname.Height); + g.DrawString(Option.XAxis.Name, SubFont, ForeColor, DrawOrigin.X + (DrawSize.Width - sfname.Width) / 2.0f, DrawOrigin.Y + Option.XAxis.AxisTick.Length + sfname.Height); } if (Option.YAxis.AxisTick.Show) @@ -507,11 +507,11 @@ namespace Sunny.UI float DrawBarHeight = DrawSize.Height * 1.0f / (YAxisEnd - YAxisStart); for (int i = YAxisStart; i <= YAxisEnd; i++) { - g.DrawLine(ChartStyle.ForeColor, DrawOrigin.X, start, DrawOrigin.X - Option.YAxis.AxisTick.Length, start); + g.DrawLine(ForeColor, DrawOrigin.X, start, DrawOrigin.X - Option.YAxis.AxisTick.Length, start); if (i != 0) { - using (Pen pn = new Pen(ChartStyle.ForeColor)) + using (Pen pn = new Pen(ForeColor)) { pn.DashStyle = DashStyle.Dash; pn.DashPattern = new float[] { 3, 3 }; @@ -520,12 +520,12 @@ namespace Sunny.UI } else { - g.DrawLine(ChartStyle.ForeColor, DrawOrigin.X, start, Width - Option.Grid.Right, start); + g.DrawLine(ForeColor, DrawOrigin.X, start, Width - Option.Grid.Right, start); float lineStart = DrawOrigin.X; for (int j = 0; j <= Option.XAxis.Data.Count; j++) { - g.DrawLine(ChartStyle.ForeColor, lineStart, start, lineStart, start + Option.XAxis.AxisTick.Length); + g.DrawLine(ForeColor, lineStart, start, lineStart, start + Option.XAxis.AxisTick.Length); lineStart += DrawBarWidth; } } @@ -549,14 +549,14 @@ namespace Sunny.UI string label = Option.YAxis.AxisLabel.GetLabel(i * YAxisInterval, idx); SizeF sf = g.MeasureString(label, SubFont); wmax = Math.Max(wmax, sf.Width); - g.DrawString(label, SubFont, ChartStyle.ForeColor, DrawOrigin.X - Option.YAxis.AxisTick.Length - sf.Width, start - sf.Height / 2.0f); + g.DrawString(label, SubFont, ForeColor, DrawOrigin.X - Option.YAxis.AxisTick.Length - sf.Width, start - sf.Height / 2.0f); start -= DrawBarHeight; } SizeF sfname = g.MeasureString(Option.YAxis.Name, SubFont); int x = (int)(DrawOrigin.X - Option.YAxis.AxisTick.Length - wmax - sfname.Height); int y = (int)(Option.Grid.Top + (DrawSize.Height - sfname.Width) / 2); - g.DrawString(Option.YAxis.Name, SubFont, ChartStyle.ForeColor, new Point(x, y), + g.DrawString(Option.YAxis.Name, SubFont, ForeColor, new Point(x, y), new StringFormat() { Alignment = StringAlignment.Center }, 270); } } @@ -569,6 +569,7 @@ namespace Sunny.UI double ymax = YAxisEnd * YAxisInterval; float pos = (float)((line.Value - ymin) * (Height - Option.Grid.Top - Option.Grid.Bottom) / (ymax - ymin)); pos = (Height - Option.Grid.Bottom - pos); + if (pos <= Option.Grid.Top || pos >= Height - Option.Grid.Bottom) continue; using (Pen pn = new Pen(line.Color, line.Size)) { g.DrawLine(pn, DrawOrigin.X, pos, Width - Option.Grid.Right, pos); diff --git a/SunnyUI/Charts/UILineChart.cs b/SunnyUI/Charts/UILineChart.cs index 51458bad..656ddd22 100644 --- a/SunnyUI/Charts/UILineChart.cs +++ b/SunnyUI/Charts/UILineChart.cs @@ -197,11 +197,11 @@ namespace Sunny.UI private void DrawAxis(Graphics g) { - g.DrawRectangle(ChartStyle.ForeColor, Option.Grid.Left, Option.Grid.Top, DrawSize.Width, DrawSize.Height); + g.DrawRectangle(ForeColor, Option.Grid.Left, Option.Grid.Top, DrawSize.Width, DrawSize.Height); float zeroPos = YScale.CalcYPixel(0, DrawOrigin.Y, DrawSize.Height); if (zeroPos > Option.Grid.Top && zeroPos < Height - Option.Grid.Bottom) { - g.DrawLine(ChartStyle.ForeColor, DrawOrigin.X, zeroPos, DrawOrigin.X + DrawSize.Width, zeroPos); + g.DrawLine(ForeColor, DrawOrigin.X, zeroPos, DrawOrigin.X + DrawSize.Width, zeroPos); } if (XScale == null || YScale == null) return; @@ -234,13 +234,13 @@ namespace Sunny.UI } SizeF sf = g.MeasureString(label, SubFont); - g.DrawString(label, SubFont, ChartStyle.ForeColor, x - sf.Width / 2.0f, DrawOrigin.Y + Option.XAxis.AxisTick.Length); + g.DrawString(label, SubFont, ForeColor, x - sf.Width / 2.0f, DrawOrigin.Y + Option.XAxis.AxisTick.Length); } if (x.Equals(DrawOrigin.X)) continue; if (x.Equals(DrawOrigin.X + DrawSize.Width)) continue; - using (Pen pn = new Pen(ChartStyle.ForeColor)) + using (Pen pn = new Pen(ForeColor)) { pn.DashStyle = DashStyle.Dash; pn.DashPattern = new float[] { 3, 3 }; @@ -249,7 +249,7 @@ namespace Sunny.UI } SizeF sfName = g.MeasureString(Option.XAxis.Name, SubFont); - g.DrawString(Option.XAxis.Name, SubFont, ChartStyle.ForeColor, + g.DrawString(Option.XAxis.Name, SubFont, ForeColor, DrawOrigin.X + (DrawSize.Width - sfName.Width) / 2.0f, DrawOrigin.Y + Option.XAxis.AxisTick.Length + sfName.Height); } @@ -269,13 +269,13 @@ namespace Sunny.UI string label = YLabels[i].ToString(YScale.Format); SizeF sf = g.MeasureString(label, SubFont); widthMax = Math.Max(widthMax, sf.Width); - g.DrawString(label, SubFont, ChartStyle.ForeColor, DrawOrigin.X - Option.YAxis.AxisTick.Length - sf.Width, y - sf.Height / 2.0f); + g.DrawString(label, SubFont, ForeColor, DrawOrigin.X - Option.YAxis.AxisTick.Length - sf.Width, y - sf.Height / 2.0f); } if (y.Equals(DrawOrigin.Y)) continue; if (y.Equals(DrawOrigin.X - DrawSize.Height)) continue; - using (Pen pn = new Pen(ChartStyle.ForeColor)) + using (Pen pn = new Pen(ForeColor)) { pn.DashStyle = DashStyle.Dash; pn.DashPattern = new float[] { 3, 3 }; @@ -286,7 +286,7 @@ namespace Sunny.UI SizeF sfName = g.MeasureString(Option.YAxis.Name, SubFont); float xx = DrawOrigin.X - Option.YAxis.AxisTick.Length - widthMax - sfName.Height / 2.0f; float yy = Option.Grid.Top + DrawSize.Height / 2.0f; - g.DrawStringRotateAtCenter(Option.YAxis.Name, SubFont, ChartStyle.ForeColor, new PointF(xx, yy), 270); + g.DrawStringRotateAtCenter(Option.YAxis.Name, SubFont, ForeColor, new PointF(xx, yy), 270); } } @@ -322,17 +322,17 @@ namespace Sunny.UI using (Graphics graphics = bmp.Graphics()) { - graphics.FillRectangle(ChartStyle.BackColor, 0, 0, Width, Height); + graphics.FillRectangle(FillColor, 0, 0, Width, Height); } using (Graphics graphics = bmpGreater.Graphics()) { - graphics.FillRectangle(ChartStyle.BackColor, 0, 0, Width, Height); + graphics.FillRectangle(FillColor, 0, 0, Width, Height); } using (Graphics graphics = bmpLess.Graphics()) { - graphics.FillRectangle(ChartStyle.BackColor, 0, 0, Width, Height); + graphics.FillRectangle(FillColor, 0, 0, Width, Height); } int idx = 0; @@ -430,7 +430,7 @@ namespace Sunny.UI if (series.Symbol != UILinePointSymbol.None) { - using (Brush br = new SolidBrush(ChartStyle.BackColor)) + using (Brush br = new SolidBrush(FillColor)) using (Pen pn = new Pen(color, series.SymbolLineWidth)) { foreach (var p in series.Points) diff --git a/SunnyUI/Controls/UINavMenu.cs b/SunnyUI/Controls/UINavMenu.cs index a97805d8..9ecdabea 100644 --- a/SunnyUI/Controls/UINavMenu.cs +++ b/SunnyUI/Controls/UINavMenu.cs @@ -874,6 +874,11 @@ namespace Sunny.UI return node; } + public TreeNode CreateNode(int symbol, int symbolSize, UIPage page) + { + return CreateNode(new NavMenuItem(page), symbol, symbolSize); + } + public TreeNode CreateNode(string text, int symbol, int symbolSize, int pageIndex) { return CreateNode(new NavMenuItem(text, pageIndex), symbol, symbolSize); diff --git a/SunnyUI/Controls/UINavMenuHelper.cs b/SunnyUI/Controls/UINavMenuHelper.cs index 73e092c0..5844a075 100644 --- a/SunnyUI/Controls/UINavMenuHelper.cs +++ b/SunnyUI/Controls/UINavMenuHelper.cs @@ -392,6 +392,8 @@ namespace Sunny.UI Text = page.Text; PageIndex = page.PageIndex; PageGuid = page.PageGuid; + Symbol = page.Symbol; + SymbolSize = page.SymbolSize; AlwaysOpen = page.AlwaysOpen; }