diff --git a/Bin/net40/SunnyUI.dll b/Bin/net40/SunnyUI.dll index bcb61538..a8d2b818 100644 Binary files a/Bin/net40/SunnyUI.dll and b/Bin/net40/SunnyUI.dll differ diff --git a/SunnyUI/Controls/UIColorPicker.cs b/SunnyUI/Controls/UIColorPicker.cs index 6c453240..7e53715d 100644 --- a/SunnyUI/Controls/UIColorPicker.cs +++ b/SunnyUI/Controls/UIColorPicker.cs @@ -45,8 +45,8 @@ namespace Sunny.UI // this.DropDownStyle = UIDropDownStyle.DropDownList; this.Name = "UIColorPicker"; - this.Padding = new System.Windows.Forms.Padding(0, 0, 30, 0); - this.ButtonClick += new System.EventHandler(this.UIColorPicker_ButtonClick); + this.Padding = new Padding(0, 0, 30, 0); + this.ButtonClick += this.UIColorPicker_ButtonClick; this.ResumeLayout(false); this.PerformLayout(); } @@ -109,7 +109,7 @@ namespace Sunny.UI protected override void OnPaintFore(Graphics g, System.Drawing.Drawing2D.GraphicsPath path) { base.OnPaintFore(g, path); - var pathColor = g.CreateRoundedRectanglePath(new Rectangle(3, 3, Width - 32, Height - 7), 5, UICornerRadiusSides.All); + var pathColor = g.CreateRoundedRectanglePath(new Rectangle(3, 3, Width - 32, Height - 7), 3, UICornerRadiusSides.All); g.FillPath(Value, pathColor); } diff --git a/SunnyUI/Controls/UIComboBox.cs b/SunnyUI/Controls/UIComboBox.cs index 5c6bd112..928a63dd 100644 --- a/SunnyUI/Controls/UIComboBox.cs +++ b/SunnyUI/Controls/UIComboBox.cs @@ -321,7 +321,7 @@ namespace Sunny.UI private void UIComboBox_KeyDown(object sender, KeyEventArgs e) { - if (e.KeyCode == System.Windows.Forms.Keys.Enter) + if (e.KeyCode == Keys.Enter) { ShowDropDown(); } @@ -329,7 +329,7 @@ namespace Sunny.UI private void edit_KeyDown(object sender, KeyEventArgs e) { - if (e.KeyCode == System.Windows.Forms.Keys.Enter) + if (e.KeyCode == Keys.Enter) { ShowDropDown(); } diff --git a/SunnyUI/Controls/UIComboDataGridView.cs b/SunnyUI/Controls/UIComboDataGridView.cs index c26a642c..6646d55f 100644 --- a/SunnyUI/Controls/UIComboDataGridView.cs +++ b/SunnyUI/Controls/UIComboDataGridView.cs @@ -36,16 +36,16 @@ namespace Sunny.UI // // UIComboTreeView // - this.DropDownStyle = Sunny.UI.UIDropDownStyle.DropDownList; + this.DropDownStyle = UIDropDownStyle.DropDownList; this.Name = "UIComboTreeView"; - this.Padding = new System.Windows.Forms.Padding(0, 0, 30, 0); + this.Padding = new Padding(0, 0, 30, 0); this.ButtonClick += UIComboDataGridView_ButtonClick; this.ResumeLayout(false); this.PerformLayout(); } - private void UIComboDataGridView_ButtonClick(object sender, System.EventArgs e) + private void UIComboDataGridView_ButtonClick(object sender, EventArgs e) { ItemForm.Size = ItemSize; item.ShowButtons = true; diff --git a/SunnyUI/Controls/UIComboTreeView.cs b/SunnyUI/Controls/UIComboTreeView.cs index 2e88bf3f..b244c008 100644 --- a/SunnyUI/Controls/UIComboTreeView.cs +++ b/SunnyUI/Controls/UIComboTreeView.cs @@ -45,10 +45,10 @@ namespace Sunny.UI // // UIComboTreeView // - this.DropDownStyle = Sunny.UI.UIDropDownStyle.DropDownList; + this.DropDownStyle = UIDropDownStyle.DropDownList; this.Name = "UIComboTreeView"; - this.Padding = new System.Windows.Forms.Padding(0, 0, 30, 0); - this.ButtonClick += new System.EventHandler(this.UIComboTreeView_ButtonClick); + this.Padding = new Padding(0, 0, 30, 0); + this.ButtonClick += this.UIComboTreeView_ButtonClick; this.ResumeLayout(false); this.PerformLayout(); @@ -172,7 +172,7 @@ namespace Sunny.UI } } - private void UIComboTreeView_ButtonClick(object sender, System.EventArgs e) + private void UIComboTreeView_ButtonClick(object sender, EventArgs e) { ItemForm.Size = ItemSize; item.TreeView.ExpandAll(); diff --git a/SunnyUI/Controls/UIDateTimePicker.cs b/SunnyUI/Controls/UIDateTimePicker.cs index 3de53818..26b54603 100644 --- a/SunnyUI/Controls/UIDateTimePicker.cs +++ b/SunnyUI/Controls/UIDateTimePicker.cs @@ -32,7 +32,7 @@ namespace Sunny.UI [ToolboxItem(true)] [DefaultProperty("Value")] [DefaultEvent("ValueChanged")] - public sealed partial class UIDatetimePicker : UIDropControl,IToolTip + public sealed class UIDatetimePicker : UIDropControl, IToolTip { private void InitializeComponent() { @@ -41,10 +41,10 @@ namespace Sunny.UI // UIDatetimePicker // this.Name = "UIDatetimePicker"; - this.Padding = new System.Windows.Forms.Padding(0, 0, 30, 0); + this.Padding = new Padding(0, 0, 30, 0); this.SymbolDropDown = 61555; this.SymbolNormal = 61555; - this.ButtonClick += new System.EventHandler(this.UIDatetimePicker_ButtonClick); + this.ButtonClick += this.UIDatetimePicker_ButtonClick; this.ResumeLayout(false); this.PerformLayout(); diff --git a/SunnyUI/Controls/UIFlowLayoutPanel.cs b/SunnyUI/Controls/UIFlowLayoutPanel.cs index eb211b74..3ede30a2 100644 --- a/SunnyUI/Controls/UIFlowLayoutPanel.cs +++ b/SunnyUI/Controls/UIFlowLayoutPanel.cs @@ -91,7 +91,7 @@ namespace Sunny.UI timer?.Dispose(); } - [DefaultValue(System.Windows.Forms.FlowDirection.LeftToRight)] + [DefaultValue(FlowDirection.LeftToRight)] [Localizable(true)] public FlowDirection FlowDirection { @@ -377,31 +377,31 @@ namespace Sunny.UI private void InitializeComponent() { - this.flowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel(); - this.VBar = new Sunny.UI.UIVerScrollBarEx(); - this.HBar = new Sunny.UI.UIHorScrollBarEx(); + this.flowLayoutPanel = new FlowLayoutPanel(); + this.VBar = new UIVerScrollBarEx(); + this.HBar = new UIHorScrollBarEx(); this.SuspendLayout(); // // flowLayoutPanel // - this.flowLayoutPanel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255))))); - this.flowLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill; - this.flowLayoutPanel.Location = new System.Drawing.Point(2, 2); + this.flowLayoutPanel.BackColor = Color.FromArgb(235, 243, 255); + this.flowLayoutPanel.Dock = DockStyle.Fill; + this.flowLayoutPanel.Location = new Point(2, 2); this.flowLayoutPanel.Name = "flowLayoutPanel"; - this.flowLayoutPanel.Size = new System.Drawing.Size(429, 383); + this.flowLayoutPanel.Size = new Size(429, 383); this.flowLayoutPanel.TabIndex = 0; this.flowLayoutPanel.Tag = "69605093-6397-AD32-9F69-3C29F642F87E"; // // VBar // this.VBar.BoundsHeight = 10; - this.VBar.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.VBar.Font = new Font("微软雅黑", 12F, FontStyle.Regular, GraphicsUnit.Point); this.VBar.LargeChange = 10; - this.VBar.Location = new System.Drawing.Point(410, 5); + this.VBar.Location = new Point(410, 5); this.VBar.Maximum = 100; - this.VBar.MinimumSize = new System.Drawing.Size(1, 1); + this.VBar.MinimumSize = new Size(1, 1); this.VBar.Name = "VBar"; - this.VBar.Size = new System.Drawing.Size(18, 377); + this.VBar.Size = new Size(18, 377); this.VBar.TabIndex = 1; this.VBar.TagString = "63FD1249-41D3-E08A-F8F5-CC41CC30FD03"; this.VBar.Text = "uiVerScrollBarEx1"; @@ -411,13 +411,13 @@ namespace Sunny.UI // HBar // this.HBar.BoundsWidth = 10; - this.HBar.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.HBar.Font = new Font("微软雅黑", 12F, FontStyle.Regular, GraphicsUnit.Point); this.HBar.LargeChange = 10; - this.HBar.Location = new System.Drawing.Point(5, 364); + this.HBar.Location = new Point(5, 364); this.HBar.Maximum = 100; - this.HBar.MinimumSize = new System.Drawing.Size(1, 1); + this.HBar.MinimumSize = new Size(1, 1); this.HBar.Name = "HBar"; - this.HBar.Size = new System.Drawing.Size(399, 18); + this.HBar.Size = new Size(399, 18); this.HBar.TabIndex = 2; this.HBar.TagString = "79E1E7DD-3E4D-916B-C8F1-F45B579C290C"; this.HBar.Text = "uiHorScrollBarEx1"; @@ -430,8 +430,8 @@ namespace Sunny.UI this.Controls.Add(this.VBar); this.Controls.Add(this.flowLayoutPanel); this.Name = "UIFlowLayoutPanel"; - this.Padding = new System.Windows.Forms.Padding(2); - this.Size = new System.Drawing.Size(433, 387); + this.Padding = new Padding(2); + this.Size = new Size(433, 387); this.ResumeLayout(false); } diff --git a/SunnyUI/Controls/UIHorScrollBar.cs b/SunnyUI/Controls/UIHorScrollBar.cs index 5f0f9cd6..971a308e 100644 --- a/SunnyUI/Controls/UIHorScrollBar.cs +++ b/SunnyUI/Controls/UIHorScrollBar.cs @@ -254,7 +254,7 @@ namespace Sunny.UI } scrollValue = value; - ValueChanged?.Invoke(this, null); + ValueChanged?.Invoke(this, EventArgs.Empty); Invalidate(); } diff --git a/SunnyUI/Controls/UIHorScrollBarEx.cs b/SunnyUI/Controls/UIHorScrollBarEx.cs index c84bfa5d..f800bbf9 100644 --- a/SunnyUI/Controls/UIHorScrollBarEx.cs +++ b/SunnyUI/Controls/UIHorScrollBarEx.cs @@ -133,14 +133,14 @@ namespace Sunny.UI { int value = (Value - LargeChange).CheckInRange(0, Maximum - BoundsWidth); Value = value; - ValueChanged?.Invoke(this, null); + ValueChanged?.Invoke(this, EventArgs.Empty); } if (inRightArea) { int value = (Value + LargeChange).CheckInRange(0, Maximum - BoundsWidth); Value = value; - ValueChanged?.Invoke(this, null); + ValueChanged?.Invoke(this, EventArgs.Empty); } if (inCenterArea) @@ -149,7 +149,7 @@ namespace Sunny.UI int value = (e.Location.X - x / 2) * maximum / (Width - 32); value = value.CheckInRange(0, Maximum - BoundsWidth); Value = value; - ValueChanged?.Invoke(this, null); + ValueChanged?.Invoke(this, EventArgs.Empty); } } @@ -220,7 +220,7 @@ namespace Sunny.UI int value = (e.Location.X - x / 2) * maximum / (Width - 32); value = value.CheckInRange(0, Maximum - BoundsWidth); Value = value; - ValueChanged?.Invoke(this, null); + ValueChanged?.Invoke(this, EventArgs.Empty); } } diff --git a/SunnyUI/Controls/UILabel.cs b/SunnyUI/Controls/UILabel.cs index d07a4695..66a3dbcb 100644 --- a/SunnyUI/Controls/UILabel.cs +++ b/SunnyUI/Controls/UILabel.cs @@ -24,7 +24,6 @@ using System; using System.ComponentModel; using System.Drawing; -using System.Drawing.Design; using System.Windows.Forms; namespace Sunny.UI diff --git a/SunnyUI/Controls/UILedBulb.cs b/SunnyUI/Controls/UILedBulb.cs index 0633d753..37a7feba 100644 --- a/SunnyUI/Controls/UILedBulb.cs +++ b/SunnyUI/Controls/UILedBulb.cs @@ -151,7 +151,7 @@ namespace Sunny.UI // Draw the background ellipse var rectangle = new Rectangle(Padding.Left, Padding.Top, diameter, diameter); - g.FillEllipse(darkColor, rectangle, true); + g.FillEllipse(darkColor, rectangle); // Draw the glow gradient var path = new GraphicsPath(); diff --git a/SunnyUI/Controls/UILight.cs b/SunnyUI/Controls/UILight.cs index ca265a8e..02af96de 100644 --- a/SunnyUI/Controls/UILight.cs +++ b/SunnyUI/Controls/UILight.cs @@ -223,7 +223,7 @@ namespace Sunny.UI } } - private bool showLightLine = false; + private bool showLightLine; [DefaultValue(false)] [Description("显示灯光亮线"), Category("SunnyUI")] diff --git a/SunnyUI/Controls/UINavMenu.cs b/SunnyUI/Controls/UINavMenu.cs index 34f75c3f..32895232 100644 --- a/SunnyUI/Controls/UINavMenu.cs +++ b/SunnyUI/Controls/UINavMenu.cs @@ -460,14 +460,14 @@ namespace Sunny.UI MenuHelper.SetPageIndex(node, pageIndex); } - public void SetNodeTipsText(TreeNode node, string tipsText) + public void SetNodeTipsText(TreeNode node, string nodeTipsText) { - MenuHelper.SetTipsText(node, tipsText); + MenuHelper.SetTipsText(node, nodeTipsText); } - public void SetNodeTipsText(TreeNode node, string tipsText, Color tipsBackColor, Color tipsForeColor) + public void SetNodeTipsText(TreeNode node, string nodeTipsText, Color nodeTipsBackColor, Color nodeTipsForeColor) { - MenuHelper.SetTipsText(node, tipsText, tipsBackColor, tipsForeColor); + MenuHelper.SetTipsText(node, nodeTipsText, nodeTipsBackColor, nodeTipsForeColor); } public void SetNodeSymbol(TreeNode node, int symbol, int symbolSize = 24) diff --git a/SunnyUI/Controls/UINavMenuHelper.cs b/SunnyUI/Controls/UINavMenuHelper.cs index 225a1741..e2416523 100644 --- a/SunnyUI/Controls/UINavMenuHelper.cs +++ b/SunnyUI/Controls/UINavMenuHelper.cs @@ -399,7 +399,7 @@ namespace Sunny.UI public Guid PageGuid { get; set; } = Guid.Empty; - public bool AlwaysOpen { get; set; } = false; + public bool AlwaysOpen { get; set; } public NavMenuItem() diff --git a/SunnyUI/Controls/UIPagination.cs b/SunnyUI/Controls/UIPagination.cs index 249b2163..817be84a 100644 --- a/SunnyUI/Controls/UIPagination.cs +++ b/SunnyUI/Controls/UIPagination.cs @@ -268,7 +268,7 @@ namespace Sunny.UI dataSource = value; activePage = 1; TotalCount = dataManager?.List.Count ?? 0; - DataSourceChanged?.Invoke(this, null); + DataSourceChanged?.Invoke(this, EventArgs.Empty); } } diff --git a/SunnyUI/Controls/UIPipe.cs b/SunnyUI/Controls/UIPipe.cs index 6fe3ee56..38ec6074 100644 --- a/SunnyUI/Controls/UIPipe.cs +++ b/SunnyUI/Controls/UIPipe.cs @@ -561,7 +561,7 @@ namespace Sunny.UI return result; } - private int FlowPos = 0; + private int FlowPos; private void PaintFlow(Graphics g) { diff --git a/SunnyUI/Controls/UIScrollBar.cs b/SunnyUI/Controls/UIScrollBar.cs index 28d8a4e2..b40ca4f5 100644 --- a/SunnyUI/Controls/UIScrollBar.cs +++ b/SunnyUI/Controls/UIScrollBar.cs @@ -259,7 +259,7 @@ namespace Sunny.UI } scrollValue = value; - ValueChanged?.Invoke(this, null); + ValueChanged?.Invoke(this, EventArgs.Empty); Invalidate(); } diff --git a/SunnyUI/Controls/UISymbolLabel.cs b/SunnyUI/Controls/UISymbolLabel.cs index 5b1a654d..1d4d3d4d 100644 --- a/SunnyUI/Controls/UISymbolLabel.cs +++ b/SunnyUI/Controls/UISymbolLabel.cs @@ -36,7 +36,7 @@ namespace Sunny.UI private int _symbolSize = 24; private int _imageInterval = 2; - private Color symbolColor = UIFontColor.Primary; + private Color symbolColor; public UISymbolLabel() { diff --git a/SunnyUI/Controls/UITabControl.cs b/SunnyUI/Controls/UITabControl.cs index 00b9e9ca..fb947a65 100644 --- a/SunnyUI/Controls/UITabControl.cs +++ b/SunnyUI/Controls/UITabControl.cs @@ -664,7 +664,7 @@ namespace Sunny.UI } } - private int LastIndex = 0; + private int LastIndex; public void Init() { diff --git a/SunnyUI/Controls/UITextBox.cs b/SunnyUI/Controls/UITextBox.cs index 71c58be1..041ce213 100644 --- a/SunnyUI/Controls/UITextBox.cs +++ b/SunnyUI/Controls/UITextBox.cs @@ -311,7 +311,7 @@ namespace Sunny.UI private void Edit_MouseWheel(object sender, MouseEventArgs e) { - base.OnMouseWheel(e); + OnMouseWheel(e); if (bar != null && bar.Visible && edit != null) { var si = ScrollBarInfo.GetInfo(edit.Handle); @@ -1074,7 +1074,7 @@ namespace Sunny.UI } } - private int _symbol = 0; + private int _symbol; [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] [Editor(typeof(UIImagePropertyEditor), typeof(UITypeEditor))] diff --git a/SunnyUI/Controls/UITimePicker.cs b/SunnyUI/Controls/UITimePicker.cs index d03e1b09..68ea7f26 100644 --- a/SunnyUI/Controls/UITimePicker.cs +++ b/SunnyUI/Controls/UITimePicker.cs @@ -30,7 +30,7 @@ namespace Sunny.UI [ToolboxItem(true)] [DefaultProperty("Value")] [DefaultEvent("ValueChanged")] - public sealed partial class UITimePicker : UIDropControl,IToolTip + public sealed class UITimePicker : UIDropControl, IToolTip { private void InitializeComponent() { @@ -39,10 +39,10 @@ namespace Sunny.UI // UITimePicker // this.Name = "UITimePicker"; - this.Padding = new System.Windows.Forms.Padding(0, 0, 30, 0); + this.Padding = new Padding(0, 0, 30, 0); this.SymbolDropDown = 61555; this.SymbolNormal = 61555; - this.ButtonClick += new System.EventHandler(this.UITimePicker_ButtonClick); + this.ButtonClick += this.UITimePicker_ButtonClick; this.ResumeLayout(false); this.PerformLayout(); } diff --git a/SunnyUI/Controls/UIToolTip.cs b/SunnyUI/Controls/UIToolTip.cs index 244c2c43..170d6438 100644 --- a/SunnyUI/Controls/UIToolTip.cs +++ b/SunnyUI/Controls/UIToolTip.cs @@ -274,7 +274,7 @@ namespace Sunny.UI public string Title { get; set; } public string Description { get; set; } - public int Symbol { get; set; } = 0; + public int Symbol { get; set; } public int SymbolSize { get; set; } = 32; diff --git a/SunnyUI/Controls/UITrackBar.cs b/SunnyUI/Controls/UITrackBar.cs index c3276822..a612dc65 100644 --- a/SunnyUI/Controls/UITrackBar.cs +++ b/SunnyUI/Controls/UITrackBar.cs @@ -128,7 +128,7 @@ namespace Sunny.UI Invalidate(); } - ValueChanged?.Invoke(this, null); + ValueChanged?.Invoke(this, EventArgs.Empty); } } diff --git a/SunnyUI/Controls/UITreeView.cs b/SunnyUI/Controls/UITreeView.cs index da824526..7ad99b66 100644 --- a/SunnyUI/Controls/UITreeView.cs +++ b/SunnyUI/Controls/UITreeView.cs @@ -27,7 +27,6 @@ using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; -using System.Data; using System.Drawing; using System.Drawing.Design; using System.Drawing.Drawing2D; @@ -862,7 +861,7 @@ namespace Sunny.UI { lineX -= Indent; - if (pNode != null && Nodes.Count > 0) + if (Nodes.Count > 0) { if (pNode.NextNode != null) e.Graphics.DrawLine(pn, lineX, lineY, lineX, e.Node.Bounds.Top); @@ -912,7 +911,7 @@ namespace Sunny.UI } } - private bool TreeNodeSelected(DrawTreeNodeEventArgs e) + public bool TreeNodeSelected(DrawTreeNodeEventArgs e) { return e.State == TreeNodeStates.Selected || e.State == TreeNodeStates.Focused || e.State == (TreeNodeStates.Focused | TreeNodeStates.Selected); @@ -984,7 +983,7 @@ namespace Sunny.UI if (parentNode.Parent != null) //如果父节点之上还有父节点 { - SetParentNodeCheckedState(parentNode, ByMouse); //递归调用 + SetParentNodeCheckedState(parentNode, true); //递归调用 } } diff --git a/SunnyUI/Controls/UIValve.cs b/SunnyUI/Controls/UIValve.cs index b2fb320c..85868c3a 100644 --- a/SunnyUI/Controls/UIValve.cs +++ b/SunnyUI/Controls/UIValve.cs @@ -390,8 +390,6 @@ namespace Sunny.UI pt4 = new Point(Width / 2 + 4, Height - pipeSize - 8 - 7); e.Graphics.FillPolygon(rectColor, new PointF[] { pt1, pt2, pt3, pt4, pt1 }); break; - default: - break; } } } diff --git a/SunnyUI/Controls/UIVerScrollBarEx.cs b/SunnyUI/Controls/UIVerScrollBarEx.cs index 182d01e3..b24b5be5 100644 --- a/SunnyUI/Controls/UIVerScrollBarEx.cs +++ b/SunnyUI/Controls/UIVerScrollBarEx.cs @@ -132,14 +132,14 @@ namespace Sunny.UI { int value = (Value - LargeChange).CheckInRange(0, Maximum - BoundsHeight); Value = value; - ValueChanged?.Invoke(this, null); + ValueChanged?.Invoke(this, EventArgs.Empty); } if (inRightArea) { int value = (Value + LargeChange).CheckInRange(0, Maximum - BoundsHeight); Value = value; - ValueChanged?.Invoke(this, null); + ValueChanged?.Invoke(this, EventArgs.Empty); } if (inCenterArea) @@ -148,7 +148,7 @@ namespace Sunny.UI int value = (e.Location.Y - y / 2) * maximum / (Height - 32); value = value.CheckInRange(0, Maximum - BoundsHeight); Value = value; - ValueChanged?.Invoke(this, null); + ValueChanged?.Invoke(this, EventArgs.Empty); } } @@ -219,7 +219,7 @@ namespace Sunny.UI int value = (e.Location.Y - y / 2) * maximum / (Height - 32); value = value.CheckInRange(0, Maximum - BoundsHeight); Value = value; - ValueChanged?.Invoke(this, null); + ValueChanged?.Invoke(this, EventArgs.Empty); } } diff --git a/SunnyUI/Font/UIFontImage.cs b/SunnyUI/Font/UIFontImage.cs index 5f1d349a..09b46c7e 100644 --- a/SunnyUI/Font/UIFontImage.cs +++ b/SunnyUI/Font/UIFontImage.cs @@ -136,7 +136,6 @@ namespace Sunny.UI public static void DrawFontImage(this Graphics graphics, int symbol, int symbolSize, Color color, RectangleF rect, int xOffset = 0, int yOffSet = 0) { - UISymbolType symbolType = (UISymbolType)symbol.Div(100000); SizeF sf = graphics.GetFontImageSize(symbol, symbolSize); graphics.DrawFontImage(symbol, symbolSize, color, rect.Left + ((rect.Width - sf.Width) / 2.0f).RoundEx(), rect.Top + ((rect.Height - sf.Height) / 2.0f).RoundEx(), xOffset, yOffSet); @@ -186,7 +185,7 @@ namespace Sunny.UI using (Graphics g = image.Graphics()) { SizeF sf = g.GetFontImageSize(symbol, size); - g.DrawFontImage(symbol, size, color, (image.Width - sf.Width) / 2.0f, (image.Height - sf.Height) / 2.0f, 0, 0); + g.DrawFontImage(symbol, size, color, (image.Width - sf.Width) / 2.0f, (image.Height - sf.Height) / 2.0f); } return image; diff --git a/SunnyUI/Font/UIFontImages.cs b/SunnyUI/Font/UIFontImages.cs index 478b1eff..398a8d5a 100644 --- a/SunnyUI/Font/UIFontImages.cs +++ b/SunnyUI/Font/UIFontImages.cs @@ -291,8 +291,12 @@ namespace Sunny.UI var t = typeof(FontAwesomeIcons); foreach (var fieldInfo in t.GetFields()) { - int value = fieldInfo.GetRawConstantValue().ToString().ToInt(); - FontAwesomeV4Labels.Enqueue(CreateLabel(value, UISymbolType.FontAwesomeV4)); + object obj = fieldInfo.GetRawConstantValue(); + if (obj != null) + { + int value = obj.ToString().ToInt(); + FontAwesomeV4Labels.Enqueue(CreateLabel(value, UISymbolType.FontAwesomeV4)); + } } } @@ -301,8 +305,12 @@ namespace Sunny.UI var t = typeof(FontElegantIcons); foreach (var fieldInfo in t.GetFields()) { - int value = fieldInfo.GetRawConstantValue().ToString().ToInt(); - ElegantIconsLabels.Enqueue(CreateLabel(value, UISymbolType.FontAwesomeV4)); + object obj = fieldInfo.GetRawConstantValue(); + if (obj != null) + { + int value = obj.ToString().ToInt(); + ElegantIconsLabels.Enqueue(CreateLabel(value, UISymbolType.FontAwesomeV4)); + } } } @@ -311,8 +319,12 @@ namespace Sunny.UI var t = typeof(FontAweSomeV5Brands); foreach (var fieldInfo in t.GetFields()) { - int value = fieldInfo.GetRawConstantValue().ToString().ToInt(); - FontAwesomeV5BrandsLabels.Enqueue(CreateLabel(value, UISymbolType.FontAwesomeV5Brands)); + object obj = fieldInfo.GetRawConstantValue(); + if (obj != null) + { + int value = obj.ToString().ToInt(); + FontAwesomeV5BrandsLabels.Enqueue(CreateLabel(value, UISymbolType.FontAwesomeV5Brands)); + } } } @@ -321,8 +333,12 @@ namespace Sunny.UI var t = typeof(FontAweSomeV5Regular); foreach (var fieldInfo in t.GetFields()) { - int value = fieldInfo.GetRawConstantValue().ToString().ToInt(); - FontAwesomeV5RegularLabels.Enqueue(CreateLabel(value, UISymbolType.FontAwesomeV5Regular)); + object obj = fieldInfo.GetRawConstantValue(); + if (obj != null) + { + int value = obj.ToString().ToInt(); + FontAwesomeV5RegularLabels.Enqueue(CreateLabel(value, UISymbolType.FontAwesomeV5Regular)); + } } } @@ -331,8 +347,12 @@ namespace Sunny.UI var t = typeof(FontAweSomeV5Solid); foreach (var fieldInfo in t.GetFields()) { - int value = fieldInfo.GetRawConstantValue().ToString().ToInt(); - FontAwesomeV5SolidLabels.Enqueue(CreateLabel(value, UISymbolType.FontAwesomeV5Solid)); + object obj = fieldInfo.GetRawConstantValue(); + if (obj != null) + { + int value = obj.ToString().ToInt(); + FontAwesomeV5SolidLabels.Enqueue(CreateLabel(value, UISymbolType.FontAwesomeV5Solid)); + } } } } diff --git a/SunnyUI/Style/UIRandomColor.cs b/SunnyUI/Style/UIRandomColor.cs index efd286b5..07c99328 100644 --- a/SunnyUI/Style/UIRandomColor.cs +++ b/SunnyUI/Style/UIRandomColor.cs @@ -31,10 +31,6 @@ namespace Sunny.UI { get; set; } - public Range BrightnessRange - { - get; set; - } } private static readonly Dictionary ColorDictionary = new Dictionary(); @@ -206,7 +202,7 @@ namespace Sunny.UI var m = (v2 - v1) / (s2 - s1); var b = v1 - m * s1; - return (int)(m * S + b); + return m * S + b; } } @@ -270,15 +266,12 @@ namespace Sunny.UI var sMin = jagged[0][0]; var sMax = jagged[jagged.Length - 1][0]; - var bMin = jagged[jagged.Length - 1][1]; - var bMax = jagged[0][1]; ColorDictionary[scheme] = new DefinedColor() { HueRange = Range.ToRange(hueRange), LowerBounds = jagged.Select(j => new Point(j[0], j[1])).ToArray(), - SaturationRange = new Range(sMin, sMax), - BrightnessRange = new Range(bMin, bMax) + SaturationRange = new Range(sMin, sMax) }; } @@ -345,7 +338,7 @@ namespace Sunny.UI { h = 1; } - if (h == 360) + if (h.EqualsDouble(360)) { h = 359; } diff --git a/SunnyUI/Style/UIStyleColor.cs b/SunnyUI/Style/UIStyleColor.cs index c304d388..5da10e7c 100644 --- a/SunnyUI/Style/UIStyleColor.cs +++ b/SunnyUI/Style/UIStyleColor.cs @@ -164,7 +164,7 @@ namespace Sunny.UI { public UIPurpleStyle() { - Init(UIColor.Purple, UIStyle.Purple, Color.White); + base.Init(UIColor.Purple, UIStyle.Purple, Color.White); } } @@ -172,7 +172,7 @@ namespace Sunny.UI { public UILightPurpleStyle() { - InitPlain(UIColor.Purple, UIStyle.LightPurple, Color.White); + base.InitPlain(UIColor.Purple, UIStyle.LightPurple, Color.White); } } @@ -180,7 +180,7 @@ namespace Sunny.UI { public UIColorfulStyle() { - Init(Color.FromArgb(0, 190, 172), UIStyle.Colorful, Color.White); + base.Init(Color.FromArgb(0, 190, 172), UIStyle.Colorful, Color.White); } public void Init(Color styleColor, Color foreColor)