From 15ba594d3f05fdfedaa2959725803cf0133553d6 Mon Sep 17 00:00:00 2001 From: Sunny Date: Mon, 27 Jun 2022 15:55:46 +0800 Subject: [PATCH] =?UTF-8?q?*=20UIMessageBox:=20=E8=AF=A2=E9=97=AE=E7=AA=97?= =?UTF-8?q?=E5=8F=A3=E7=9A=84Focus=E6=8C=89=E9=92=AE=E7=9A=84=E7=BB=98?= =?UTF-8?q?=E5=88=B6=E7=BA=BF=E6=8D=A2=E6=88=90=E8=83=8C=E6=99=AF=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SunnyUI/Common/UGDI.cs | 7 --- SunnyUI/Controls/UIControl.cs | 6 +-- SunnyUI/Forms/UIMessageForm.Designer.cs | 13 +++--- SunnyUI/Forms/UIMessageForm.cs | 12 +++-- SunnyUI/Forms/UIMessageForm.resx | 62 ++++++++++++++++++++++++- 5 files changed, 78 insertions(+), 22 deletions(-) diff --git a/SunnyUI/Common/UGDI.cs b/SunnyUI/Common/UGDI.cs index 4d938bc4..c398fdd5 100644 --- a/SunnyUI/Common/UGDI.cs +++ b/SunnyUI/Common/UGDI.cs @@ -149,13 +149,6 @@ namespace Sunny.UI return region; } - public static Color Alpha(this Color color, int alpha) - { - alpha = Math.Max(0, alpha); - alpha = Math.Min(255, alpha); - return Color.FromArgb(alpha, color); - } - private static Graphics TempGraphics; /// diff --git a/SunnyUI/Controls/UIControl.cs b/SunnyUI/Controls/UIControl.cs index 5db62682..c81ed1f0 100644 --- a/SunnyUI/Controls/UIControl.cs +++ b/SunnyUI/Controls/UIControl.cs @@ -437,7 +437,7 @@ namespace Sunny.UI if (selected) color = rectSelectedColor; if (ShowFocusColor && Focused) - color = rectPressColor; + color = rectHoverColor; if (isReadOnly) color = rectReadOnlyColor; return Enabled ? color : rectDisableColor; @@ -468,7 +468,7 @@ namespace Sunny.UI if (selected) color = foreSelectedColor; if (ShowFocusColor && Focused) - color = forePressColor; + color = foreHoverColor; if (isReadOnly) color = foreReadOnlyColor; return Enabled ? color : foreDisableColor; @@ -489,7 +489,7 @@ namespace Sunny.UI if (selected) color = fillSelectedColor; if (ShowFocusColor && Focused) - color = fillPressColor; + color = fillHoverColor; if (isReadOnly) color = fillReadOnlyColor; return Enabled ? color : fillDisableColor; diff --git a/SunnyUI/Forms/UIMessageForm.Designer.cs b/SunnyUI/Forms/UIMessageForm.Designer.cs index 7b2c917a..a4ad1a4c 100644 --- a/SunnyUI/Forms/UIMessageForm.Designer.cs +++ b/SunnyUI/Forms/UIMessageForm.Designer.cs @@ -37,17 +37,17 @@ // this.btnCancel.BackColor = System.Drawing.Color.Transparent; this.btnCancel.Cursor = System.Windows.Forms.Cursors.Hand; - this.btnCancel.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.btnCancel.Font = new System.Drawing.Font("微软雅黑", 12F); this.btnCancel.Location = new System.Drawing.Point(224, 220); this.btnCancel.Margin = new System.Windows.Forms.Padding(0); this.btnCancel.MinimumSize = new System.Drawing.Size(1, 1); this.btnCancel.Name = "btnCancel"; - this.btnCancel.RadiusSides = Sunny.UI.UICornerRadiusSides.None; - this.btnCancel.RectSides = ((System.Windows.Forms.ToolStripStatusLabelBorderSides)((System.Windows.Forms.ToolStripStatusLabelBorderSides.Left | System.Windows.Forms.ToolStripStatusLabelBorderSides.Top))); this.btnCancel.Size = new System.Drawing.Size(224, 48); this.btnCancel.TabIndex = 6; this.btnCancel.Text = "取消"; + this.btnCancel.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnCancel.TipsText = null; + this.btnCancel.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); this.btnCancel.MouseEnter += new System.EventHandler(this.btnOK_MouseEnter); this.btnCancel.MouseLeave += new System.EventHandler(this.btnOK_MouseLeave); @@ -56,17 +56,17 @@ // this.btnOK.BackColor = System.Drawing.Color.Transparent; this.btnOK.Cursor = System.Windows.Forms.Cursors.Hand; - this.btnOK.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.btnOK.Font = new System.Drawing.Font("微软雅黑", 12F); this.btnOK.Location = new System.Drawing.Point(2, 220); this.btnOK.Margin = new System.Windows.Forms.Padding(0); this.btnOK.MinimumSize = new System.Drawing.Size(1, 1); this.btnOK.Name = "btnOK"; - this.btnOK.RadiusSides = Sunny.UI.UICornerRadiusSides.None; - this.btnOK.RectSides = ((System.Windows.Forms.ToolStripStatusLabelBorderSides)((System.Windows.Forms.ToolStripStatusLabelBorderSides.Top | System.Windows.Forms.ToolStripStatusLabelBorderSides.Right))); this.btnOK.Size = new System.Drawing.Size(223, 48); this.btnOK.TabIndex = 5; this.btnOK.Text = "确定"; + this.btnOK.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnOK.TipsText = null; + this.btnOK.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); this.btnOK.Click += new System.EventHandler(this.btnOK_Click); this.btnOK.MouseEnter += new System.EventHandler(this.btnOK_MouseEnter); this.btnOK.MouseLeave += new System.EventHandler(this.btnOK_MouseLeave); @@ -98,6 +98,7 @@ this.Padding = new System.Windows.Forms.Padding(1, 35, 1, 3); this.ShowInTaskbar = false; this.Text = "UIMsgBox"; + this.ZoomScaleRect = new System.Drawing.Rectangle(15, 15, 450, 270); this.ResumeLayout(false); } diff --git a/SunnyUI/Forms/UIMessageForm.cs b/SunnyUI/Forms/UIMessageForm.cs index 98325f91..988ac419 100644 --- a/SunnyUI/Forms/UIMessageForm.cs +++ b/SunnyUI/Forms/UIMessageForm.cs @@ -65,14 +65,15 @@ namespace Sunny.UI if (_showCancel) { - btnOK.RectSides = ToolStripStatusLabelBorderSides.Top | ToolStripStatusLabelBorderSides.Right; + //btnOK.RectSides = ToolStripStatusLabelBorderSides.Top | ToolStripStatusLabelBorderSides.Right; + //btnOK.RectSides = btnCancel.RectSides = ToolStripStatusLabelBorderSides.All; btnOK.Width = btnCancel.Width = Width / 2 - 2; btnCancel.Left = btnOK.Left + btnOK.Width - 1; btnCancel.Width = Width - btnCancel.Left - 2; } else { - btnOK.RectSides = ToolStripStatusLabelBorderSides.Top; + //btnOK.RectSides = ToolStripStatusLabelBorderSides.Top; btnOK.Width = Width - 4; } @@ -131,12 +132,12 @@ namespace Sunny.UI private void btnOK_MouseEnter(object sender, EventArgs e) { - ((UIButton)sender).RadiusSides = UICornerRadiusSides.All; + //((UIButton)sender).RadiusSides = UICornerRadiusSides.All; } private void btnOK_MouseLeave(object sender, EventArgs e) { - ((UIButton)sender).RadiusSides = UICornerRadiusSides.None; + //((UIButton)sender).RadiusSides = UICornerRadiusSides.None; } public void ShowMessage(string message, string title, bool showCancel, UIStyle style = UIStyle.Blue) @@ -145,7 +146,8 @@ namespace Sunny.UI Text = title; lbMsg.Text = message; ShowCancel = showCancel; - btnOK.ShowFocusLine = btnCancel.ShowFocusLine = showCancel; + //btnOK.ShowFocusLine = btnCancel.ShowFocusLine = showCancel; + btnOK.ShowFocusColor = btnCancel.ShowFocusColor = showCancel; } } } \ No newline at end of file diff --git a/SunnyUI/Forms/UIMessageForm.resx b/SunnyUI/Forms/UIMessageForm.resx index f298a7be..1af7de15 100644 --- a/SunnyUI/Forms/UIMessageForm.resx +++ b/SunnyUI/Forms/UIMessageForm.resx @@ -1,4 +1,64 @@ - + + +