+ UIWaitForm:等待窗体
+ UIWaitFormService:多线程显示等待窗体 + UIStatusFormService:多线程显示进度窗体
This commit is contained in:
parent
802ef17a7b
commit
b15b14087f
Binary file not shown.
BIN
Bin/SunnyUI.dll
BIN
Bin/SunnyUI.dll
Binary file not shown.
83
SunnyUI.Demo/Forms/FDialogs.Designer.cs
generated
83
SunnyUI.Demo/Forms/FDialogs.Designer.cs
generated
@ -59,11 +59,15 @@
|
||||
this.uiLine8 = new Sunny.UI.UILine();
|
||||
this.uiSymbolButton3 = new Sunny.UI.UISymbolButton();
|
||||
this.uiSymbolButton10 = new Sunny.UI.UISymbolButton();
|
||||
this.uiSymbolButton11 = new Sunny.UI.UISymbolButton();
|
||||
this.uiLine9 = new Sunny.UI.UILine();
|
||||
this.PagePanel.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// PagePanel
|
||||
//
|
||||
this.PagePanel.Controls.Add(this.uiLine9);
|
||||
this.PagePanel.Controls.Add(this.uiSymbolButton11);
|
||||
this.PagePanel.Controls.Add(this.uiLine8);
|
||||
this.PagePanel.Controls.Add(this.uiSymbolButton3);
|
||||
this.PagePanel.Controls.Add(this.uiSymbolButton10);
|
||||
@ -96,7 +100,6 @@
|
||||
this.PagePanel.Controls.Add(this.btnSuccess);
|
||||
this.PagePanel.Controls.Add(this.btnAsk);
|
||||
this.PagePanel.Size = new System.Drawing.Size(800, 514);
|
||||
this.PagePanel.Style = Sunny.UI.UIStyle.Blue;
|
||||
//
|
||||
// btnError
|
||||
//
|
||||
@ -104,13 +107,16 @@
|
||||
this.btnError.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
|
||||
this.btnError.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(127)))), ((int)(((byte)(128)))));
|
||||
this.btnError.FillPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(202)))), ((int)(((byte)(87)))), ((int)(((byte)(89)))));
|
||||
this.btnError.FillSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(202)))), ((int)(((byte)(87)))), ((int)(((byte)(89)))));
|
||||
this.btnError.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.btnError.Location = new System.Drawing.Point(600, 53);
|
||||
this.btnError.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.btnError.Name = "btnError";
|
||||
this.btnError.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0);
|
||||
this.btnError.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
|
||||
this.btnError.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(127)))), ((int)(((byte)(128)))));
|
||||
this.btnError.RectPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(202)))), ((int)(((byte)(87)))), ((int)(((byte)(89)))));
|
||||
this.btnError.RectSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(202)))), ((int)(((byte)(87)))), ((int)(((byte)(89)))));
|
||||
this.btnError.Size = new System.Drawing.Size(100, 35);
|
||||
this.btnError.Style = Sunny.UI.UIStyle.Red;
|
||||
this.btnError.StyleCustomMode = true;
|
||||
@ -125,13 +131,16 @@
|
||||
this.btnWarn.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(155)))), ((int)(((byte)(40)))));
|
||||
this.btnWarn.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(223)))), ((int)(((byte)(174)))), ((int)(((byte)(86)))));
|
||||
this.btnWarn.FillPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(137)))), ((int)(((byte)(43)))));
|
||||
this.btnWarn.FillSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(137)))), ((int)(((byte)(43)))));
|
||||
this.btnWarn.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.btnWarn.Location = new System.Drawing.Point(486, 53);
|
||||
this.btnWarn.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.btnWarn.Name = "btnWarn";
|
||||
this.btnWarn.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0);
|
||||
this.btnWarn.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(155)))), ((int)(((byte)(40)))));
|
||||
this.btnWarn.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(223)))), ((int)(((byte)(174)))), ((int)(((byte)(86)))));
|
||||
this.btnWarn.RectPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(137)))), ((int)(((byte)(43)))));
|
||||
this.btnWarn.RectSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(137)))), ((int)(((byte)(43)))));
|
||||
this.btnWarn.Size = new System.Drawing.Size(100, 35);
|
||||
this.btnWarn.Style = Sunny.UI.UIStyle.Orange;
|
||||
this.btnWarn.StyleCustomMode = true;
|
||||
@ -146,13 +155,16 @@
|
||||
this.btnSuccess.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(110)))), ((int)(((byte)(190)))), ((int)(((byte)(40)))));
|
||||
this.btnSuccess.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(136)))), ((int)(((byte)(202)))), ((int)(((byte)(81)))));
|
||||
this.btnSuccess.FillPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(168)))), ((int)(((byte)(35)))));
|
||||
this.btnSuccess.FillSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(168)))), ((int)(((byte)(35)))));
|
||||
this.btnSuccess.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.btnSuccess.Location = new System.Drawing.Point(372, 53);
|
||||
this.btnSuccess.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.btnSuccess.Name = "btnSuccess";
|
||||
this.btnSuccess.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0);
|
||||
this.btnSuccess.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(110)))), ((int)(((byte)(190)))), ((int)(((byte)(40)))));
|
||||
this.btnSuccess.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(136)))), ((int)(((byte)(202)))), ((int)(((byte)(81)))));
|
||||
this.btnSuccess.RectPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(168)))), ((int)(((byte)(35)))));
|
||||
this.btnSuccess.RectSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(168)))), ((int)(((byte)(35)))));
|
||||
this.btnSuccess.Size = new System.Drawing.Size(100, 35);
|
||||
this.btnSuccess.Style = Sunny.UI.UIStyle.Green;
|
||||
this.btnSuccess.StyleCustomMode = true;
|
||||
@ -166,6 +178,7 @@
|
||||
this.btnAsk.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnAsk.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.btnAsk.Location = new System.Drawing.Point(30, 52);
|
||||
this.btnAsk.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.btnAsk.Name = "btnAsk";
|
||||
this.btnAsk.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0);
|
||||
this.btnAsk.Size = new System.Drawing.Size(100, 35);
|
||||
@ -180,6 +193,7 @@
|
||||
this.btnAuto.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnAuto.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.btnAuto.Location = new System.Drawing.Point(144, 53);
|
||||
this.btnAuto.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.btnAuto.Name = "btnAuto";
|
||||
this.btnAuto.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0);
|
||||
this.btnAuto.Size = new System.Drawing.Size(100, 35);
|
||||
@ -193,9 +207,10 @@
|
||||
this.btnStatus2.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnStatus2.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.btnStatus2.Location = new System.Drawing.Point(30, 210);
|
||||
this.btnStatus2.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.btnStatus2.Name = "btnStatus2";
|
||||
this.btnStatus2.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0);
|
||||
this.btnStatus2.Size = new System.Drawing.Size(214, 35);
|
||||
this.btnStatus2.Size = new System.Drawing.Size(155, 35);
|
||||
this.btnStatus2.Symbol = 57595;
|
||||
this.btnStatus2.TabIndex = 36;
|
||||
this.btnStatus2.Text = "进度提示框";
|
||||
@ -207,13 +222,16 @@
|
||||
this.btnInfo.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(140)))), ((int)(((byte)(140)))), ((int)(((byte)(140)))));
|
||||
this.btnInfo.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(160)))), ((int)(((byte)(165)))));
|
||||
this.btnInfo.FillPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(121)))), ((int)(((byte)(123)))), ((int)(((byte)(129)))));
|
||||
this.btnInfo.FillSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(121)))), ((int)(((byte)(123)))), ((int)(((byte)(129)))));
|
||||
this.btnInfo.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.btnInfo.Location = new System.Drawing.Point(258, 53);
|
||||
this.btnInfo.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.btnInfo.Name = "btnInfo";
|
||||
this.btnInfo.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0);
|
||||
this.btnInfo.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(140)))), ((int)(((byte)(140)))), ((int)(((byte)(140)))));
|
||||
this.btnInfo.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(160)))), ((int)(((byte)(165)))));
|
||||
this.btnInfo.RectPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(121)))), ((int)(((byte)(123)))), ((int)(((byte)(129)))));
|
||||
this.btnInfo.RectSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(121)))), ((int)(((byte)(123)))), ((int)(((byte)(129)))));
|
||||
this.btnInfo.Size = new System.Drawing.Size(100, 35);
|
||||
this.btnInfo.Style = Sunny.UI.UIStyle.Gray;
|
||||
this.btnInfo.StyleCustomMode = true;
|
||||
@ -227,6 +245,7 @@
|
||||
this.btnPasswordInput.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnPasswordInput.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.btnPasswordInput.Location = new System.Drawing.Point(543, 131);
|
||||
this.btnPasswordInput.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.btnPasswordInput.Name = "btnPasswordInput";
|
||||
this.btnPasswordInput.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0);
|
||||
this.btnPasswordInput.Size = new System.Drawing.Size(155, 35);
|
||||
@ -240,6 +259,7 @@
|
||||
this.btnDoubleInput.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnDoubleInput.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.btnDoubleInput.Location = new System.Drawing.Point(372, 131);
|
||||
this.btnDoubleInput.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.btnDoubleInput.Name = "btnDoubleInput";
|
||||
this.btnDoubleInput.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0);
|
||||
this.btnDoubleInput.Size = new System.Drawing.Size(155, 35);
|
||||
@ -253,6 +273,7 @@
|
||||
this.btnIntInput.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnIntInput.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.btnIntInput.Location = new System.Drawing.Point(201, 131);
|
||||
this.btnIntInput.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.btnIntInput.Name = "btnIntInput";
|
||||
this.btnIntInput.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0);
|
||||
this.btnIntInput.Size = new System.Drawing.Size(155, 35);
|
||||
@ -266,6 +287,7 @@
|
||||
this.btnStringInput.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnStringInput.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.btnStringInput.Location = new System.Drawing.Point(30, 131);
|
||||
this.btnStringInput.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.btnStringInput.Name = "btnStringInput";
|
||||
this.btnStringInput.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0);
|
||||
this.btnStringInput.Size = new System.Drawing.Size(155, 35);
|
||||
@ -302,9 +324,9 @@
|
||||
this.uiLine3.Location = new System.Drawing.Point(30, 178);
|
||||
this.uiLine3.MinimumSize = new System.Drawing.Size(16, 16);
|
||||
this.uiLine3.Name = "uiLine3";
|
||||
this.uiLine3.Size = new System.Drawing.Size(328, 20);
|
||||
this.uiLine3.Size = new System.Drawing.Size(155, 20);
|
||||
this.uiLine3.TabIndex = 49;
|
||||
this.uiLine3.Text = "UIStatusDialog";
|
||||
this.uiLine3.Text = "UIStatusForm";
|
||||
this.uiLine3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// uiLine4
|
||||
@ -323,9 +345,10 @@
|
||||
this.uiSymbolButton1.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.uiSymbolButton1.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiSymbolButton1.Location = new System.Drawing.Point(372, 210);
|
||||
this.uiSymbolButton1.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.uiSymbolButton1.Name = "uiSymbolButton1";
|
||||
this.uiSymbolButton1.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0);
|
||||
this.uiSymbolButton1.Size = new System.Drawing.Size(214, 35);
|
||||
this.uiSymbolButton1.Size = new System.Drawing.Size(155, 35);
|
||||
this.uiSymbolButton1.Symbol = 61655;
|
||||
this.uiSymbolButton1.TabIndex = 50;
|
||||
this.uiSymbolButton1.Text = "下拉选择框";
|
||||
@ -347,6 +370,7 @@
|
||||
this.uiSymbolButton2.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.uiSymbolButton2.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiSymbolButton2.Location = new System.Drawing.Point(30, 289);
|
||||
this.uiSymbolButton2.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.uiSymbolButton2.Name = "uiSymbolButton2";
|
||||
this.uiSymbolButton2.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0);
|
||||
this.uiSymbolButton2.Size = new System.Drawing.Size(100, 35);
|
||||
@ -362,13 +386,16 @@
|
||||
this.uiSymbolButton4.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
|
||||
this.uiSymbolButton4.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(127)))), ((int)(((byte)(128)))));
|
||||
this.uiSymbolButton4.FillPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(202)))), ((int)(((byte)(87)))), ((int)(((byte)(89)))));
|
||||
this.uiSymbolButton4.FillSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(202)))), ((int)(((byte)(87)))), ((int)(((byte)(89)))));
|
||||
this.uiSymbolButton4.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiSymbolButton4.Location = new System.Drawing.Point(372, 289);
|
||||
this.uiSymbolButton4.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.uiSymbolButton4.Name = "uiSymbolButton4";
|
||||
this.uiSymbolButton4.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0);
|
||||
this.uiSymbolButton4.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
|
||||
this.uiSymbolButton4.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(127)))), ((int)(((byte)(128)))));
|
||||
this.uiSymbolButton4.RectPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(202)))), ((int)(((byte)(87)))), ((int)(((byte)(89)))));
|
||||
this.uiSymbolButton4.RectSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(202)))), ((int)(((byte)(87)))), ((int)(((byte)(89)))));
|
||||
this.uiSymbolButton4.Size = new System.Drawing.Size(100, 35);
|
||||
this.uiSymbolButton4.Style = Sunny.UI.UIStyle.Red;
|
||||
this.uiSymbolButton4.StyleCustomMode = true;
|
||||
@ -383,13 +410,16 @@
|
||||
this.uiSymbolButton5.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(155)))), ((int)(((byte)(40)))));
|
||||
this.uiSymbolButton5.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(223)))), ((int)(((byte)(174)))), ((int)(((byte)(86)))));
|
||||
this.uiSymbolButton5.FillPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(137)))), ((int)(((byte)(43)))));
|
||||
this.uiSymbolButton5.FillSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(137)))), ((int)(((byte)(43)))));
|
||||
this.uiSymbolButton5.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiSymbolButton5.Location = new System.Drawing.Point(258, 289);
|
||||
this.uiSymbolButton5.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.uiSymbolButton5.Name = "uiSymbolButton5";
|
||||
this.uiSymbolButton5.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0);
|
||||
this.uiSymbolButton5.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(155)))), ((int)(((byte)(40)))));
|
||||
this.uiSymbolButton5.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(223)))), ((int)(((byte)(174)))), ((int)(((byte)(86)))));
|
||||
this.uiSymbolButton5.RectPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(137)))), ((int)(((byte)(43)))));
|
||||
this.uiSymbolButton5.RectSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(137)))), ((int)(((byte)(43)))));
|
||||
this.uiSymbolButton5.Size = new System.Drawing.Size(100, 35);
|
||||
this.uiSymbolButton5.Style = Sunny.UI.UIStyle.Orange;
|
||||
this.uiSymbolButton5.StyleCustomMode = true;
|
||||
@ -404,13 +434,16 @@
|
||||
this.uiSymbolButton6.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(110)))), ((int)(((byte)(190)))), ((int)(((byte)(40)))));
|
||||
this.uiSymbolButton6.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(136)))), ((int)(((byte)(202)))), ((int)(((byte)(81)))));
|
||||
this.uiSymbolButton6.FillPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(168)))), ((int)(((byte)(35)))));
|
||||
this.uiSymbolButton6.FillSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(168)))), ((int)(((byte)(35)))));
|
||||
this.uiSymbolButton6.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiSymbolButton6.Location = new System.Drawing.Point(144, 289);
|
||||
this.uiSymbolButton6.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.uiSymbolButton6.Name = "uiSymbolButton6";
|
||||
this.uiSymbolButton6.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0);
|
||||
this.uiSymbolButton6.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(110)))), ((int)(((byte)(190)))), ((int)(((byte)(40)))));
|
||||
this.uiSymbolButton6.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(136)))), ((int)(((byte)(202)))), ((int)(((byte)(81)))));
|
||||
this.uiSymbolButton6.RectPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(168)))), ((int)(((byte)(35)))));
|
||||
this.uiSymbolButton6.RectSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(168)))), ((int)(((byte)(35)))));
|
||||
this.uiSymbolButton6.Size = new System.Drawing.Size(100, 35);
|
||||
this.uiSymbolButton6.Style = Sunny.UI.UIStyle.Green;
|
||||
this.uiSymbolButton6.StyleCustomMode = true;
|
||||
@ -435,6 +468,7 @@
|
||||
this.btnEN.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnEN.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.btnEN.Location = new System.Drawing.Point(144, 447);
|
||||
this.btnEN.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.btnEN.Name = "btnEN";
|
||||
this.btnEN.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0);
|
||||
this.btnEN.Size = new System.Drawing.Size(100, 35);
|
||||
@ -448,6 +482,7 @@
|
||||
this.btnCH.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnCH.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.btnCH.Location = new System.Drawing.Point(30, 447);
|
||||
this.btnCH.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.btnCH.Name = "btnCH";
|
||||
this.btnCH.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0);
|
||||
this.btnCH.Size = new System.Drawing.Size(100, 35);
|
||||
@ -474,13 +509,16 @@
|
||||
this.uiSymbolButton7.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
|
||||
this.uiSymbolButton7.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(127)))), ((int)(((byte)(128)))));
|
||||
this.uiSymbolButton7.FillPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(202)))), ((int)(((byte)(87)))), ((int)(((byte)(89)))));
|
||||
this.uiSymbolButton7.FillSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(202)))), ((int)(((byte)(87)))), ((int)(((byte)(89)))));
|
||||
this.uiSymbolButton7.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiSymbolButton7.Location = new System.Drawing.Point(258, 368);
|
||||
this.uiSymbolButton7.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.uiSymbolButton7.Name = "uiSymbolButton7";
|
||||
this.uiSymbolButton7.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0);
|
||||
this.uiSymbolButton7.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
|
||||
this.uiSymbolButton7.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(127)))), ((int)(((byte)(128)))));
|
||||
this.uiSymbolButton7.RectPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(202)))), ((int)(((byte)(87)))), ((int)(((byte)(89)))));
|
||||
this.uiSymbolButton7.RectSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(202)))), ((int)(((byte)(87)))), ((int)(((byte)(89)))));
|
||||
this.uiSymbolButton7.Size = new System.Drawing.Size(100, 35);
|
||||
this.uiSymbolButton7.Style = Sunny.UI.UIStyle.Red;
|
||||
this.uiSymbolButton7.StyleCustomMode = true;
|
||||
@ -495,13 +533,16 @@
|
||||
this.uiSymbolButton8.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(155)))), ((int)(((byte)(40)))));
|
||||
this.uiSymbolButton8.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(223)))), ((int)(((byte)(174)))), ((int)(((byte)(86)))));
|
||||
this.uiSymbolButton8.FillPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(137)))), ((int)(((byte)(43)))));
|
||||
this.uiSymbolButton8.FillSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(137)))), ((int)(((byte)(43)))));
|
||||
this.uiSymbolButton8.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiSymbolButton8.Location = new System.Drawing.Point(144, 368);
|
||||
this.uiSymbolButton8.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.uiSymbolButton8.Name = "uiSymbolButton8";
|
||||
this.uiSymbolButton8.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0);
|
||||
this.uiSymbolButton8.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(155)))), ((int)(((byte)(40)))));
|
||||
this.uiSymbolButton8.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(223)))), ((int)(((byte)(174)))), ((int)(((byte)(86)))));
|
||||
this.uiSymbolButton8.RectPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(137)))), ((int)(((byte)(43)))));
|
||||
this.uiSymbolButton8.RectSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(137)))), ((int)(((byte)(43)))));
|
||||
this.uiSymbolButton8.Size = new System.Drawing.Size(100, 35);
|
||||
this.uiSymbolButton8.Style = Sunny.UI.UIStyle.Orange;
|
||||
this.uiSymbolButton8.StyleCustomMode = true;
|
||||
@ -516,13 +557,16 @@
|
||||
this.uiSymbolButton9.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(110)))), ((int)(((byte)(190)))), ((int)(((byte)(40)))));
|
||||
this.uiSymbolButton9.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(136)))), ((int)(((byte)(202)))), ((int)(((byte)(81)))));
|
||||
this.uiSymbolButton9.FillPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(168)))), ((int)(((byte)(35)))));
|
||||
this.uiSymbolButton9.FillSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(168)))), ((int)(((byte)(35)))));
|
||||
this.uiSymbolButton9.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiSymbolButton9.Location = new System.Drawing.Point(30, 368);
|
||||
this.uiSymbolButton9.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.uiSymbolButton9.Name = "uiSymbolButton9";
|
||||
this.uiSymbolButton9.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0);
|
||||
this.uiSymbolButton9.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(110)))), ((int)(((byte)(190)))), ((int)(((byte)(40)))));
|
||||
this.uiSymbolButton9.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(136)))), ((int)(((byte)(202)))), ((int)(((byte)(81)))));
|
||||
this.uiSymbolButton9.RectPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(168)))), ((int)(((byte)(35)))));
|
||||
this.uiSymbolButton9.RectSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(168)))), ((int)(((byte)(35)))));
|
||||
this.uiSymbolButton9.Size = new System.Drawing.Size(100, 35);
|
||||
this.uiSymbolButton9.Style = Sunny.UI.UIStyle.Green;
|
||||
this.uiSymbolButton9.StyleCustomMode = true;
|
||||
@ -547,6 +591,7 @@
|
||||
this.uiSymbolButton3.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.uiSymbolButton3.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiSymbolButton3.Location = new System.Drawing.Point(486, 368);
|
||||
this.uiSymbolButton3.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.uiSymbolButton3.Name = "uiSymbolButton3";
|
||||
this.uiSymbolButton3.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0);
|
||||
this.uiSymbolButton3.Size = new System.Drawing.Size(100, 35);
|
||||
@ -560,6 +605,7 @@
|
||||
this.uiSymbolButton10.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.uiSymbolButton10.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiSymbolButton10.Location = new System.Drawing.Point(372, 368);
|
||||
this.uiSymbolButton10.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.uiSymbolButton10.Name = "uiSymbolButton10";
|
||||
this.uiSymbolButton10.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0);
|
||||
this.uiSymbolButton10.Size = new System.Drawing.Size(100, 35);
|
||||
@ -568,6 +614,31 @@
|
||||
this.uiSymbolButton10.Text = "Login";
|
||||
this.uiSymbolButton10.Click += new System.EventHandler(this.uiSymbolButton10_Click);
|
||||
//
|
||||
// uiSymbolButton11
|
||||
//
|
||||
this.uiSymbolButton11.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.uiSymbolButton11.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiSymbolButton11.Location = new System.Drawing.Point(201, 210);
|
||||
this.uiSymbolButton11.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.uiSymbolButton11.Name = "uiSymbolButton11";
|
||||
this.uiSymbolButton11.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0);
|
||||
this.uiSymbolButton11.Size = new System.Drawing.Size(155, 35);
|
||||
this.uiSymbolButton11.Symbol = 61806;
|
||||
this.uiSymbolButton11.TabIndex = 70;
|
||||
this.uiSymbolButton11.Text = "等待提示框";
|
||||
this.uiSymbolButton11.Click += new System.EventHandler(this.uiSymbolButton11_Click);
|
||||
//
|
||||
// uiLine9
|
||||
//
|
||||
this.uiLine9.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiLine9.Location = new System.Drawing.Point(201, 178);
|
||||
this.uiLine9.MinimumSize = new System.Drawing.Size(16, 16);
|
||||
this.uiLine9.Name = "uiLine9";
|
||||
this.uiLine9.Size = new System.Drawing.Size(155, 20);
|
||||
this.uiLine9.TabIndex = 71;
|
||||
this.uiLine9.Text = "UIWaitingForm";
|
||||
this.uiLine9.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// FDialogs
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);
|
||||
@ -614,5 +685,7 @@
|
||||
private UILine uiLine8;
|
||||
private UISymbolButton uiSymbolButton3;
|
||||
private UISymbolButton uiSymbolButton10;
|
||||
private UISymbolButton uiSymbolButton11;
|
||||
private UILine uiLine9;
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
namespace Sunny.UI.Demo
|
||||
{
|
||||
@ -44,13 +45,15 @@ namespace Sunny.UI.Demo
|
||||
|
||||
private void btnStatus2_Click(object sender, EventArgs e)
|
||||
{
|
||||
ShowStatus("提示", "数据加载中......");
|
||||
for (int i = 0; i < 100; i++)
|
||||
ShowStatusForm(100, "数据加载中......");
|
||||
for (int i = 0; i < 88; i++)
|
||||
{
|
||||
SystemEx.Delay(50);
|
||||
StatusDescription = "数据加载中(" + i + "%)......";
|
||||
StatusStepIt();
|
||||
SetStatusFormDescription("数据加载中(" + i + "%)......");
|
||||
StatusFormStepIt();
|
||||
}
|
||||
|
||||
HideStatusForm();
|
||||
}
|
||||
|
||||
private void btnInfo_Click(object sender, EventArgs e)
|
||||
@ -183,5 +186,14 @@ namespace Sunny.UI.Demo
|
||||
{
|
||||
return userName == "admin" && password == "admin";
|
||||
}
|
||||
|
||||
private void uiSymbolButton11_Click(object sender, EventArgs e)
|
||||
{
|
||||
ShowWaitForm();
|
||||
Thread.Sleep(3000);
|
||||
SetWaitFormDescription(UILocalize.SystemProcessing + "50%");
|
||||
Thread.Sleep(3000);
|
||||
HideWaitForm();
|
||||
}
|
||||
}
|
||||
}
|
@ -39,8 +39,6 @@ namespace Sunny.UI
|
||||
|
||||
public readonly Guid Guid = Guid.NewGuid();
|
||||
|
||||
private UIStatusForm statusForm;
|
||||
|
||||
public UIForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
@ -79,42 +77,64 @@ namespace Sunny.UI
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 显示进度窗口
|
||||
/// 显示进度提示窗
|
||||
/// </summary>
|
||||
/// <param name="title">进度窗口的标题</param>
|
||||
/// <param name="desc">进度窗口的描述</param>
|
||||
/// <param name="max">最大进度值</param>
|
||||
/// <param name="value">当前进度值</param>
|
||||
public void ShowStatus(string title, string desc, int max = 100, int value = 0)
|
||||
/// <param name="desc">描述文字</param>
|
||||
/// <param name="maximum">最大进度值</param>
|
||||
public void ShowStatusForm(int maximum = 100, string desc = "系统处理中,请稍候......")
|
||||
{
|
||||
StatusForm.Style = Style;
|
||||
StatusForm.Show(title, desc, max, value);
|
||||
}
|
||||
|
||||
public UIStatusForm StatusForm => statusForm ?? (statusForm = new UIStatusForm());
|
||||
|
||||
/// <summary>
|
||||
/// 隐藏进度窗口
|
||||
/// </summary>
|
||||
public void HideStatus()
|
||||
{
|
||||
StatusForm.Hide();
|
||||
UIStatusFormService.ShowStatusForm(maximum, desc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 使进度条按步长自增一次
|
||||
/// 隐藏进度提示窗
|
||||
/// </summary>
|
||||
public void StatusStepIt()
|
||||
public void HideStatusForm()
|
||||
{
|
||||
StatusForm.StepIt();
|
||||
UIStatusFormService.HideStatusForm();
|
||||
}
|
||||
|
||||
[DefaultValue(null)]
|
||||
[Browsable(false)]
|
||||
public string StatusDescription
|
||||
/// <summary>
|
||||
/// 设置进度提示窗步进值加1
|
||||
/// </summary>
|
||||
public void StatusFormStepIt()
|
||||
{
|
||||
get => StatusForm?.Description;
|
||||
set => StatusForm.Description = value;
|
||||
UIStatusFormService.StepIt();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置进度提示窗描述文字
|
||||
/// </summary>
|
||||
/// <param name="desc">描述文字</param>
|
||||
public void SetStatusFormDescription(string desc)
|
||||
{
|
||||
UIStatusFormService.SetDescription(desc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 显示等待提示窗
|
||||
/// </summary>
|
||||
/// <param name="desc">描述文字</param>
|
||||
public void ShowWaitForm(string desc = "系统处理中,请稍候......")
|
||||
{
|
||||
UIWaitFormService.ShowWaitForm(desc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 隐藏等待提示窗
|
||||
/// </summary>
|
||||
public void HideWaitForm()
|
||||
{
|
||||
UIWaitFormService.HideWaitForm();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置等待提示窗描述文字
|
||||
/// </summary>
|
||||
/// <param name="desc">描述文字</param>
|
||||
public void SetWaitFormDescription(string desc)
|
||||
{
|
||||
UIWaitFormService.SetDescription(desc);
|
||||
}
|
||||
|
||||
protected override void OnBackColorChanged(EventArgs e)
|
||||
|
191
SunnyUI/Forms/UIFormService.cs
Normal file
191
SunnyUI/Forms/UIFormService.cs
Normal file
@ -0,0 +1,191 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Sunny.UI
|
||||
{
|
||||
public class UIWaitFormService
|
||||
{
|
||||
private static bool IsRun;
|
||||
public static void ShowWaitForm(string desc = "系统处理中,请稍候......")
|
||||
{
|
||||
if (IsRun) return;
|
||||
Instance.CreateForm(desc);
|
||||
IsRun = true;
|
||||
}
|
||||
|
||||
public static void HideWaitForm()
|
||||
{
|
||||
if (!IsRun) return;
|
||||
Instance.CloseForm();
|
||||
IsRun = false;
|
||||
}
|
||||
|
||||
public static void SetDescription(string desc)
|
||||
{
|
||||
if (!IsRun) return;
|
||||
Instance.SetFormDescription(desc);
|
||||
}
|
||||
|
||||
private static UIWaitFormService _instance;
|
||||
private static readonly object syncLock = new object();
|
||||
|
||||
private static UIWaitFormService Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
lock (syncLock)
|
||||
{
|
||||
_instance = new UIWaitFormService();
|
||||
}
|
||||
}
|
||||
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
private Thread thread;
|
||||
private UIWaitForm form;
|
||||
|
||||
private void CreateForm(string desc)
|
||||
{
|
||||
CloseForm();
|
||||
thread = new Thread(delegate ()
|
||||
{
|
||||
form = new UIWaitForm(desc);
|
||||
Application.Run(form);
|
||||
});
|
||||
|
||||
thread.Start();
|
||||
}
|
||||
|
||||
private void CloseForm()
|
||||
{
|
||||
try
|
||||
{
|
||||
thread?.Abort();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
|
||||
private void SetFormDescription(string desc)
|
||||
{
|
||||
try
|
||||
{
|
||||
form?.SetDescription(desc);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class UIStatusFormService
|
||||
{
|
||||
private static bool IsRun;
|
||||
public static void ShowStatusForm(int maximum = 100, string desc = "系统处理中,请稍候......")
|
||||
{
|
||||
if (IsRun) return;
|
||||
Instance.CreateForm(maximum, desc);
|
||||
IsRun = true;
|
||||
}
|
||||
|
||||
public static void HideStatusForm()
|
||||
{
|
||||
if (!IsRun) return;
|
||||
Instance.CloseForm();
|
||||
IsRun = false;
|
||||
}
|
||||
|
||||
public static void SetDescription(string desc)
|
||||
{
|
||||
if (!IsRun) return;
|
||||
Instance.SetFormDescription(desc);
|
||||
}
|
||||
|
||||
public static void StepIt()
|
||||
{
|
||||
if (!IsRun) return;
|
||||
Instance.SetFormStepIt();
|
||||
}
|
||||
|
||||
private static UIStatusFormService _instance;
|
||||
private static readonly object syncLock = new object();
|
||||
|
||||
private static UIStatusFormService Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
lock (syncLock)
|
||||
{
|
||||
_instance = new UIStatusFormService();
|
||||
}
|
||||
}
|
||||
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
private Thread thread;
|
||||
private UIStatusForm form;
|
||||
|
||||
private void CreateForm(int max, string desc)
|
||||
{
|
||||
CloseForm();
|
||||
thread = new Thread(delegate ()
|
||||
{
|
||||
form = new UIStatusForm(max, desc);
|
||||
form.VisibleChanged += WaitForm_VisibleChanged;
|
||||
Application.Run(form);
|
||||
IsRun = false;
|
||||
});
|
||||
|
||||
thread.Start();
|
||||
}
|
||||
|
||||
private void WaitForm_VisibleChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!form.Visible)
|
||||
{
|
||||
form.Close();
|
||||
}
|
||||
}
|
||||
|
||||
private void CloseForm()
|
||||
{
|
||||
form?.StepIt(form.Maximum);
|
||||
}
|
||||
|
||||
private void SetFormDescription(string desc)
|
||||
{
|
||||
try
|
||||
{
|
||||
form?.SetDescription(desc);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
|
||||
private void SetFormStepIt()
|
||||
{
|
||||
try
|
||||
{
|
||||
form?.StepIt();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
3
SunnyUI/Forms/UIStatusForm.Designer.cs
generated
3
SunnyUI/Forms/UIStatusForm.Designer.cs
generated
@ -67,8 +67,7 @@
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "UIStatusForm";
|
||||
this.ShowIcon = false;
|
||||
this.Text = "进度";
|
||||
this.Text = "提示";
|
||||
this.TopMost = true;
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
@ -28,6 +28,17 @@ namespace Sunny.UI
|
||||
public UIStatusForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
Text = UILocalize.InfoTitle;
|
||||
Description = UILocalize.SystemProcessing;
|
||||
}
|
||||
|
||||
public UIStatusForm(int max, string desc)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Maximum = max;
|
||||
Description = desc;
|
||||
Value = 0;
|
||||
}
|
||||
|
||||
[DefaultValue(100)]
|
||||
@ -44,11 +55,6 @@ namespace Sunny.UI
|
||||
set => processBar.Value = value;
|
||||
}
|
||||
|
||||
public void StepIt()
|
||||
{
|
||||
processBar.StepIt();
|
||||
}
|
||||
|
||||
[DefaultValue(1)]
|
||||
public int Step
|
||||
{
|
||||
@ -92,5 +98,34 @@ namespace Sunny.UI
|
||||
set => labelDescription.Text = value;
|
||||
}
|
||||
|
||||
private delegate void SetTextHandler(string text);
|
||||
|
||||
public void SetDescription(string text)
|
||||
{
|
||||
if (labelDescription.InvokeRequired)
|
||||
{
|
||||
Invoke(new SetTextHandler(SetDescription), text);
|
||||
}
|
||||
else
|
||||
{
|
||||
labelDescription.Text = text;
|
||||
labelDescription.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private delegate void StepItHandler(int step);
|
||||
|
||||
public void StepIt(int step = 1)
|
||||
{
|
||||
if (processBar.InvokeRequired)
|
||||
{
|
||||
Invoke(new StepItHandler(StepIt), step);
|
||||
}
|
||||
else
|
||||
{
|
||||
processBar.Step = step;
|
||||
processBar.StepIt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
34
SunnyUI/Forms/UIWaitForm.cs
Normal file
34
SunnyUI/Forms/UIWaitForm.cs
Normal file
@ -0,0 +1,34 @@
|
||||
namespace Sunny.UI
|
||||
{
|
||||
public partial class UIWaitForm : UIForm
|
||||
{
|
||||
public UIWaitForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
base.Text = UILocalize.InfoTitle;
|
||||
SetDescription(UILocalize.SystemProcessing);
|
||||
}
|
||||
|
||||
public UIWaitForm(string desc)
|
||||
{
|
||||
InitializeComponent();
|
||||
base.Text = UILocalize.InfoTitle;
|
||||
SetDescription(desc);
|
||||
}
|
||||
|
||||
private delegate void SetTextHandler(string text);
|
||||
|
||||
public void SetDescription(string text)
|
||||
{
|
||||
if (labelDescription.InvokeRequired)
|
||||
{
|
||||
Invoke(new SetTextHandler(SetDescription), text);
|
||||
}
|
||||
else
|
||||
{
|
||||
labelDescription.Text = text;
|
||||
labelDescription.Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
80
SunnyUI/Forms/UIWaitForm.designer.cs
generated
Normal file
80
SunnyUI/Forms/UIWaitForm.designer.cs
generated
Normal file
@ -0,0 +1,80 @@
|
||||
namespace Sunny.UI
|
||||
{
|
||||
partial class UIWaitForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.labelDescription = new Sunny.UI.UILabel();
|
||||
this.Bar = new Sunny.UI.UIWaitingBar();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// labelDescription
|
||||
//
|
||||
this.labelDescription.AutoSize = true;
|
||||
this.labelDescription.BackColor = System.Drawing.Color.Transparent;
|
||||
this.labelDescription.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.labelDescription.Location = new System.Drawing.Point(32, 55);
|
||||
this.labelDescription.Name = "labelDescription";
|
||||
this.labelDescription.Size = new System.Drawing.Size(178, 21);
|
||||
this.labelDescription.TabIndex = 4;
|
||||
this.labelDescription.Text = "系统处理中,请稍候......";
|
||||
this.labelDescription.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// Bar
|
||||
//
|
||||
this.Bar.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.Bar.Location = new System.Drawing.Point(32, 91);
|
||||
this.Bar.MinimumSize = new System.Drawing.Size(70, 23);
|
||||
this.Bar.Name = "Bar";
|
||||
this.Bar.Size = new System.Drawing.Size(409, 29);
|
||||
this.Bar.TabIndex = 6;
|
||||
this.Bar.Text = "uiWaitingBar1";
|
||||
//
|
||||
// UIWaitForm
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.ClientSize = new System.Drawing.Size(473, 153);
|
||||
this.ControlBox = false;
|
||||
this.Controls.Add(this.labelDescription);
|
||||
this.Controls.Add(this.Bar);
|
||||
this.EscClose = false;
|
||||
this.IsForbidAltF4 = true;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "UIWaitForm";
|
||||
this.Text = "提示";
|
||||
this.TopMost = true;
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private UILabel labelDescription;
|
||||
private UIWaitingBar Bar;
|
||||
}
|
||||
}
|
120
SunnyUI/Forms/UIWaitForm.resx
Normal file
120
SunnyUI/Forms/UIWaitForm.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -39,10 +39,6 @@ namespace Sunny.UI
|
||||
|
||||
protected UIStyle _style = UIStyle.Blue;
|
||||
|
||||
private UIStatusForm statusForm;
|
||||
|
||||
public UIStatusForm StatusForm => statusForm ?? (statusForm = new UIStatusForm());
|
||||
|
||||
public UIPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
@ -188,28 +184,65 @@ namespace Sunny.UI
|
||||
|
||||
public event EventHandler Initialize;
|
||||
|
||||
public void ShowStatus(string title, string desc, int max = 100, int value = 0)
|
||||
/// <summary>
|
||||
/// 显示进度提示窗
|
||||
/// </summary>
|
||||
/// <param name="desc">描述文字</param>
|
||||
/// <param name="maximum">最大进度值</param>
|
||||
public void ShowStatusForm(int maximum = 100, string desc = "系统处理中,请稍候......")
|
||||
{
|
||||
StatusForm.Style = Style;
|
||||
StatusForm.Show(title, desc, max, value);
|
||||
UIStatusFormService.ShowStatusForm(maximum, desc);
|
||||
}
|
||||
|
||||
public void HideStatus()
|
||||
/// <summary>
|
||||
/// 隐藏进度提示窗
|
||||
/// </summary>
|
||||
public void HideStatusForm()
|
||||
{
|
||||
StatusForm.Hide();
|
||||
UIStatusFormService.HideStatusForm();
|
||||
}
|
||||
|
||||
public void StatusStepIt()
|
||||
/// <summary>
|
||||
/// 设置进度提示窗步进值加1
|
||||
/// </summary>
|
||||
public void StatusFormStepIt()
|
||||
{
|
||||
StatusForm.StepIt();
|
||||
UIStatusFormService.StepIt();
|
||||
}
|
||||
|
||||
[DefaultValue(null)]
|
||||
[Browsable(false)]
|
||||
public string StatusDescription
|
||||
/// <summary>
|
||||
/// 设置进度提示窗描述文字
|
||||
/// </summary>
|
||||
/// <param name="desc">描述文字</param>
|
||||
public void SetStatusFormDescription(string desc)
|
||||
{
|
||||
get => StatusForm?.Description;
|
||||
set => StatusForm.Description = value;
|
||||
UIStatusFormService.SetDescription(desc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 显示等待提示窗
|
||||
/// </summary>
|
||||
/// <param name="desc">描述文字</param>
|
||||
public void ShowWaitForm(string desc = "系统处理中,请稍候......")
|
||||
{
|
||||
UIWaitFormService.ShowWaitForm(desc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 隐藏等待提示窗
|
||||
/// </summary>
|
||||
public void HideWaitForm()
|
||||
{
|
||||
UIWaitFormService.HideWaitForm();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置等待提示窗描述文字
|
||||
/// </summary>
|
||||
/// <param name="desc">描述文字</param>
|
||||
public void SetWaitFormDescription(string desc)
|
||||
{
|
||||
UIWaitFormService.SetDescription(desc);
|
||||
}
|
||||
|
||||
protected override void OnControlAdded(ControlEventArgs e)
|
||||
|
@ -23,19 +23,75 @@ namespace Sunny.UI
|
||||
{
|
||||
public static class UILocalize
|
||||
{
|
||||
/// <summary>
|
||||
/// 提示
|
||||
/// </summary>
|
||||
public static string InfoTitle = "提示";
|
||||
|
||||
/// <summary>
|
||||
/// 正确
|
||||
/// </summary>
|
||||
public static string SuccessTitle = "正确";
|
||||
|
||||
/// <summary>
|
||||
/// 警告
|
||||
/// </summary>
|
||||
public static string WarningTitle = "警告";
|
||||
|
||||
/// <summary>
|
||||
/// 错误
|
||||
/// </summary>
|
||||
public static string ErrorTitle = "错误";
|
||||
|
||||
/// <summary>
|
||||
/// 提示
|
||||
/// </summary>
|
||||
public static string AskTitle = "提示";
|
||||
|
||||
/// <summary>
|
||||
/// 输入
|
||||
/// </summary>
|
||||
public static string InputTitle = "输入";
|
||||
|
||||
/// <summary>
|
||||
/// 选择
|
||||
/// </summary>
|
||||
public static string SelectTitle = "选择";
|
||||
|
||||
/// <summary>
|
||||
/// 全部关闭
|
||||
/// </summary>
|
||||
public static string CloseAll = "全部关闭";
|
||||
|
||||
/// <summary>
|
||||
/// 确定
|
||||
/// </summary>
|
||||
public static string OK = "确定";
|
||||
|
||||
/// <summary>
|
||||
/// 取消
|
||||
/// </summary>
|
||||
public static string Cancel = "取消";
|
||||
|
||||
/// <summary>
|
||||
/// [ 无数据 ]
|
||||
/// </summary>
|
||||
public static string GridNoData = "[ 无数据 ]";
|
||||
|
||||
/// <summary>
|
||||
/// 数据加载中 ......
|
||||
/// </summary>
|
||||
public static string GridDataLoading = "数据加载中 ......";
|
||||
|
||||
/// <summary>
|
||||
/// 数据源必须为DataTable或者List
|
||||
/// </summary>
|
||||
public static string GridDataSourceException = "数据源必须为DataTable或者List";
|
||||
|
||||
/// <summary>
|
||||
/// 系统处理中,请稍候......
|
||||
/// </summary>
|
||||
public static string SystemProcessing = "系统处理中,请稍候......";
|
||||
}
|
||||
|
||||
public static class UILocalizeHelper
|
||||
@ -55,6 +111,7 @@ namespace Sunny.UI
|
||||
UILocalize.GridNoData = "[ No data ]";
|
||||
UILocalize.GridDataLoading = "Data loading ......";
|
||||
UILocalize.GridDataSourceException = "The data source must be DataTable or List";
|
||||
UILocalize.SystemProcessing = "System processing, please wait...";
|
||||
}
|
||||
|
||||
public static void SetCH()
|
||||
@ -72,6 +129,7 @@ namespace Sunny.UI
|
||||
UILocalize.GridNoData = "[ 无数据 ]";
|
||||
UILocalize.GridDataLoading = "数据加载中 ......";
|
||||
UILocalize.GridDataSourceException = "数据源必须为DataTable或者List";
|
||||
UILocalize.SystemProcessing = "系统处理中,请稍候......";
|
||||
}
|
||||
}
|
||||
}
|
@ -39,10 +39,9 @@ namespace Sunny.UI
|
||||
public static class UIMessageTip
|
||||
{
|
||||
//默认字体。当样式中的Font==null时用该字体替换
|
||||
private static readonly Font DefaultFont = new Font(SystemFonts.MessageBoxFont.FontFamily, 12);
|
||||
|
||||
static readonly Font DefaultFont = new Font(SystemFonts.MessageBoxFont.FontFamily, 12);
|
||||
//文本格式。用于测量和绘制
|
||||
private static readonly StringFormat DefStringFormat = StringFormat.GenericTypographic;
|
||||
static readonly StringFormat DefStringFormat = StringFormat.GenericTypographic;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置默认消息样式
|
||||
@ -120,7 +119,7 @@ namespace Sunny.UI
|
||||
/// <param name="delay">消息停留时长(ms)。默认1秒,若要使用全局时长请设为-1</param>
|
||||
/// <param name="floating">是否漂浮。默认不漂浮。若要使用全局设置请设为null</param>
|
||||
/// <param name="centerInControl">是否在控件中央显示,不指定则自动判断</param>
|
||||
public static void ShowWarning(Component controlOrItem, string text = null, int delay = 1000, bool? floating = null, bool? centerInControl = null) =>
|
||||
public static void ShowWarning(Component controlOrItem, string text = null, int delay = 1000, bool? floating = false, bool? centerInControl = null) =>
|
||||
Show(controlOrItem, text, WarningStyle ?? TipStyle.Orange, delay, floating, centerInControl);
|
||||
|
||||
/// <summary>
|
||||
@ -131,7 +130,7 @@ namespace Sunny.UI
|
||||
/// <param name="floating">是否漂浮。默认不漂浮。若要使用全局设置请设为null</param>
|
||||
/// <param name="point">消息窗显示位置。不指定则智能判定,当由工具栏项(ToolStripItem)弹出时,请指定该参数或使用接收控件的重载</param>
|
||||
/// <param name="centerByPoint">是否以point参数为中心进行呈现。为false则是在其附近呈现</param>
|
||||
public static void ShowWarning(string text = null, int delay = 1000, bool? floating = null, Point? point = null, bool centerByPoint = false) =>
|
||||
public static void ShowWarning(string text = null, int delay = 1000, bool? floating = false, Point? point = null, bool centerByPoint = false) =>
|
||||
Show(text, WarningStyle ?? TipStyle.Orange, delay, floating, point, centerByPoint);
|
||||
|
||||
/// <summary>
|
||||
@ -142,7 +141,7 @@ namespace Sunny.UI
|
||||
/// <param name="delay">消息停留时长(ms)。默认1秒,若要使用全局时长请设为-1</param>
|
||||
/// <param name="floating">是否漂浮。默认不漂浮。若要使用全局设置请设为null</param>
|
||||
/// <param name="centerInControl">是否在控件中央显示,不指定则自动判断</param>
|
||||
public static void ShowError(Component controlOrItem, string text = null, int delay = 1000, bool? floating = null, bool? centerInControl = null) =>
|
||||
public static void ShowError(Component controlOrItem, string text = null, int delay = 1000, bool? floating = false, bool? centerInControl = null) =>
|
||||
Show(controlOrItem, text, ErrorStyle ?? TipStyle.Red, delay, floating, centerInControl);
|
||||
|
||||
/// <summary>
|
||||
@ -153,7 +152,7 @@ namespace Sunny.UI
|
||||
/// <param name="floating">是否漂浮。默认不漂浮。若要使用全局设置请设为null</param>
|
||||
/// <param name="point">消息窗显示位置。不指定则智能判定,当由工具栏项(ToolStripItem)弹出时,请指定该参数或使用接收控件的重载</param>
|
||||
/// <param name="centerByPoint">是否以point参数为中心进行呈现。为false则是在其附近呈现</param>
|
||||
public static void ShowError(string text = null, int delay = 1000, bool? floating = null, Point? point = null, bool centerByPoint = false) =>
|
||||
public static void ShowError(string text = null, int delay = 1000, bool? floating = false, Point? point = null, bool centerByPoint = false) =>
|
||||
Show(text, ErrorStyle ?? TipStyle.Red, delay, floating, point, centerByPoint);
|
||||
|
||||
/// <summary>
|
||||
@ -185,7 +184,7 @@ namespace Sunny.UI
|
||||
/// <param name="centerByPoint">是否以point参数为中心进行呈现。为false则是在其附近呈现</param>
|
||||
public static void Show(string text, TipStyle style = null, int delay = -1, bool? floating = null, Point? point = null, bool centerByPoint = false)
|
||||
{
|
||||
var basePoint = point ?? DetermineActive();
|
||||
var basePoint = point ?? DetemineActive();
|
||||
|
||||
new Thread(arg =>
|
||||
{
|
||||
@ -217,12 +216,11 @@ namespace Sunny.UI
|
||||
{ IsBackground = true, Name = "T_Showing" }.Start();
|
||||
}
|
||||
|
||||
private static void layer_Showing(object sender, EventArgs e)
|
||||
static void layer_Showing(object sender, EventArgs e)
|
||||
{
|
||||
var layer = (LayeredWindow)sender;
|
||||
var args = layer.Tag as object[];
|
||||
if (args == null || args.Length <= 2) return;
|
||||
|
||||
var delay = (int)args[0];
|
||||
var floating = (bool)args[1];
|
||||
var floatDown = (bool)args[2];
|
||||
@ -248,7 +246,7 @@ namespace Sunny.UI
|
||||
layer.Close();
|
||||
}
|
||||
|
||||
private static void layer_Closing(object sender, CancelEventArgs e) =>
|
||||
static void layer_Closing(object sender, CancelEventArgs e) =>
|
||||
FadeEffect((LayeredWindow)sender, false);
|
||||
|
||||
/// <summary>
|
||||
@ -257,12 +255,12 @@ namespace Sunny.UI
|
||||
private static void FadeEffect(LayeredWindow window, bool fadeIn)
|
||||
{
|
||||
byte target = fadeIn ? byte.MaxValue : byte.MinValue;
|
||||
const int UpdateInterval = 10;//动画更新间隔(毫秒)
|
||||
int step = Fade < UpdateInterval ? 0 : (Fade / UpdateInterval);
|
||||
const int Updateinterval = 10;//动画更新间隔(毫秒)
|
||||
int step = Fade < Updateinterval ? 0 : (Fade / Updateinterval);
|
||||
|
||||
for (int i = 1; i <= step; i++)
|
||||
{
|
||||
Thread.Sleep(UpdateInterval);
|
||||
Thread.Sleep(Updateinterval);
|
||||
|
||||
if (i == step) { break; }
|
||||
|
||||
@ -276,7 +274,7 @@ namespace Sunny.UI
|
||||
/// <summary>
|
||||
/// 判定活动点
|
||||
/// </summary>
|
||||
private static Point DetermineActive()
|
||||
private static Point DetemineActive()
|
||||
{
|
||||
var point = Control.MousePosition;
|
||||
|
||||
@ -509,7 +507,7 @@ namespace Sunny.UI
|
||||
[DllImport("user32.dll")]
|
||||
private static extern IntPtr GetFocus();
|
||||
|
||||
#endregion Win32 API
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -517,12 +515,11 @@ namespace Sunny.UI
|
||||
/// </summary>
|
||||
public sealed class TipStyle : IDisposable
|
||||
{
|
||||
private bool _isPresets;
|
||||
private bool _keepFont;
|
||||
private bool _keepIcon;
|
||||
|
||||
private readonly Border _border;
|
||||
bool _isPresets;
|
||||
bool _keepFont;
|
||||
bool _keepIcon;
|
||||
|
||||
readonly Border _border;
|
||||
/// <summary>
|
||||
/// 获取边框信息。内部用
|
||||
/// </summary>
|
||||
@ -645,29 +642,25 @@ namespace Sunny.UI
|
||||
((IDisposable)this).Dispose();
|
||||
}
|
||||
|
||||
private static TipStyle _gray;
|
||||
|
||||
static TipStyle _gray;
|
||||
/// <summary>
|
||||
/// 预置的灰色样式
|
||||
/// </summary>
|
||||
public static TipStyle Gray => _gray ?? (_gray = CreatePresetsStyle(0));
|
||||
|
||||
private static TipStyle _green;
|
||||
|
||||
static TipStyle _green;
|
||||
/// <summary>
|
||||
/// 预置的绿色样式
|
||||
/// </summary>
|
||||
public static TipStyle Green => _green ?? (_green = CreatePresetsStyle(1));
|
||||
|
||||
private static TipStyle _orange;
|
||||
|
||||
static TipStyle _orange;
|
||||
/// <summary>
|
||||
/// 预置的橙色样式
|
||||
/// </summary>
|
||||
public static TipStyle Orange => _orange ?? (_orange = CreatePresetsStyle(2));
|
||||
|
||||
private static TipStyle _red;
|
||||
|
||||
static TipStyle _red;
|
||||
/// <summary>
|
||||
/// 预置的红色样式
|
||||
/// </summary>
|
||||
@ -682,7 +675,6 @@ namespace Sunny.UI
|
||||
ShadowColor = PresetsResources.Colors[index, 2],
|
||||
_isPresets = true
|
||||
};
|
||||
|
||||
style.BackBrush = r =>
|
||||
{
|
||||
var brush = new LinearGradientBrush(r,
|
||||
@ -692,12 +684,10 @@ namespace Sunny.UI
|
||||
brush.SetBlendTriangularShape(0.5f);
|
||||
return brush;
|
||||
};
|
||||
|
||||
return style;
|
||||
}
|
||||
|
||||
private bool _disposed;
|
||||
|
||||
bool _disposed;
|
||||
[Obsolete("请改用Clear指定是否清理字体和图标")]
|
||||
[MethodImpl(MethodImplOptions.Synchronized)]
|
||||
void IDisposable.Dispose()
|
||||
@ -833,12 +823,10 @@ namespace Sunny.UI
|
||||
/// 居中
|
||||
/// </summary>
|
||||
Middle,
|
||||
|
||||
/// <summary>
|
||||
/// 内部
|
||||
/// </summary>
|
||||
Inner,
|
||||
|
||||
/// <summary>
|
||||
/// 外部
|
||||
/// </summary>
|
||||
@ -857,12 +845,11 @@ namespace Sunny.UI
|
||||
// - 再利用画笔的CompoundArray属性将边框裁切掉一半,
|
||||
// 同时根据不同参数偏移描边位置,达到可内可外可居中的效果
|
||||
|
||||
private float[] _compoundArray;
|
||||
|
||||
float[] _compoundArray;
|
||||
/// <summary>
|
||||
/// 根据_direction处理线段
|
||||
/// </summary>
|
||||
private float[] CompoundArray
|
||||
float[] CompoundArray
|
||||
{
|
||||
get
|
||||
{
|
||||
@ -881,7 +868,7 @@ namespace Sunny.UI
|
||||
}
|
||||
}
|
||||
|
||||
private readonly Pen _pen;
|
||||
readonly Pen _pen;
|
||||
|
||||
/// <summary>
|
||||
/// 获取用于画本边框的画笔。建议销毁本类而不是该画笔
|
||||
@ -906,8 +893,7 @@ namespace Sunny.UI
|
||||
set => Pen.Color = value;
|
||||
}
|
||||
|
||||
private Direction _direction;
|
||||
|
||||
Direction _direction;
|
||||
/// <summary>
|
||||
/// 边框位置。默认居中
|
||||
/// </summary>
|
||||
@ -945,9 +931,7 @@ namespace Sunny.UI
|
||||
return rectangle;
|
||||
}
|
||||
|
||||
public Border(Color color) : this(new Pen(color), false)
|
||||
{
|
||||
}
|
||||
public Border(Color color) : this(new Pen(color), false) { }
|
||||
|
||||
/// <summary>
|
||||
/// 基于现有画笔的副本构造
|
||||
@ -982,22 +966,21 @@ namespace Sunny.UI
|
||||
[SuppressUnmanagedCodeSecurity]
|
||||
public class LayeredWindow : IDisposable
|
||||
{
|
||||
private const string ClassName = "AhDungLayeredWindow";
|
||||
const string ClassName = "AhDungLayeredWindow";
|
||||
|
||||
private static WndProcDelegate _wndProc;
|
||||
static WndProcDelegate _wndProc;
|
||||
|
||||
private readonly object syncObj = new object();
|
||||
private readonly PointOrSize _size;
|
||||
private IntPtr _dcMemory;
|
||||
private IntPtr _hBmp;
|
||||
private IntPtr _oldObj;
|
||||
readonly object syncObj = new object();
|
||||
readonly PointOrSize _size;
|
||||
IntPtr _dcMemory;
|
||||
IntPtr _hBmp;
|
||||
IntPtr _oldObj;
|
||||
|
||||
private IntPtr _activeWindow; //用于模式显示时,记录并disable原窗体,然后在本类关闭后enable它
|
||||
private bool _continueLoop = true;
|
||||
private short _wndClass;
|
||||
private IntPtr _hWnd;
|
||||
|
||||
private BLENDFUNCTION _blend = new BLENDFUNCTION
|
||||
IntPtr _activeWindow; //用于模式显示时,记录并disable原窗体,然后在本类关闭后enable它
|
||||
bool _continueLoop = true;
|
||||
short _wndClass;
|
||||
IntPtr _hWnd;
|
||||
BLENDFUNCTION _blend = new BLENDFUNCTION
|
||||
{
|
||||
BlendOp = 0, //AC_SRC_OVER
|
||||
BlendFlags = 0,
|
||||
@ -1015,19 +998,14 @@ namespace Sunny.UI
|
||||
/// </summary>
|
||||
public event CancelEventHandler Closing;
|
||||
|
||||
private static IntPtr _hInstance;
|
||||
|
||||
private static IntPtr HInstance
|
||||
static IntPtr _hInstance;
|
||||
static IntPtr HInstance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_hInstance == IntPtr.Zero)
|
||||
{
|
||||
Assembly assembly = Assembly.GetEntryAssembly();
|
||||
if (assembly != null)
|
||||
{
|
||||
_hInstance = Marshal.GetHINSTANCE(assembly.ManifestModule);
|
||||
}
|
||||
_hInstance = Marshal.GetHINSTANCE(Assembly.GetEntryAssembly()?.ManifestModule);
|
||||
}
|
||||
return _hInstance;
|
||||
}
|
||||
@ -1036,7 +1014,7 @@ namespace Sunny.UI
|
||||
/// <summary>
|
||||
/// 获取窗体位置。内部用
|
||||
/// </summary>
|
||||
private PointOrSize LocationInternal => new PointOrSize(_left, _top);
|
||||
PointOrSize LocationInternal => new PointOrSize(_left, _top);
|
||||
|
||||
/// <summary>
|
||||
/// 窗体句柄
|
||||
@ -1048,8 +1026,7 @@ namespace Sunny.UI
|
||||
/// </summary>
|
||||
public bool Visible { get; private set; }
|
||||
|
||||
private int _left;
|
||||
|
||||
int _left;
|
||||
/// <summary>
|
||||
/// 获取或设置左边缘坐标
|
||||
/// </summary>
|
||||
@ -1064,8 +1041,7 @@ namespace Sunny.UI
|
||||
}
|
||||
}
|
||||
|
||||
private int _top;
|
||||
|
||||
int _top;
|
||||
/// <summary>
|
||||
/// 获取或设置上边缘坐标
|
||||
/// </summary>
|
||||
@ -1098,15 +1074,14 @@ namespace Sunny.UI
|
||||
/// <summary>
|
||||
/// 获取窗体宽度
|
||||
/// </summary>
|
||||
public int Width { get; }
|
||||
public int Width { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取窗体高度
|
||||
/// </summary>
|
||||
public int Height { get; }
|
||||
|
||||
private float _opacity;
|
||||
public int Height { get; private set; }
|
||||
|
||||
float _opacity;
|
||||
/// <summary>
|
||||
/// 获取或设置窗体透明度(建议优先用Alpha)。0=完全透明;1=不透明
|
||||
/// </summary>
|
||||
@ -1161,7 +1136,7 @@ namespace Sunny.UI
|
||||
/// <summary>
|
||||
/// 是否在任务栏显示
|
||||
/// </summary>
|
||||
public bool ShowInTaskBar { get; set; }
|
||||
public bool ShowInTaskbar { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否让鼠标事件穿透本窗体
|
||||
@ -1249,7 +1224,7 @@ namespace Sunny.UI
|
||||
if (TopMost) { exStyle |= 0x8; } //WS_EX_TOPMOST
|
||||
if (!Activation) { exStyle |= 0x08000000; } //WS_EX_NOACTIVATE
|
||||
if (MouseThrough) { exStyle |= 0x20; } //WS_EX_TRANSPARENT
|
||||
if (ShowInTaskBar) { exStyle |= 0x40000; } //WS_EX_APPWINDOW
|
||||
if (ShowInTaskbar) { exStyle |= 0x40000; } //WS_EX_APPWINDOW
|
||||
|
||||
int style = unchecked((int)0x80000000) //WS_POPUP。不能加WS_VISIBLE,会抢焦点,改用ShowWindow显示
|
||||
| 0x80000; //WS_SYSMENU
|
||||
@ -1290,7 +1265,6 @@ namespace Sunny.UI
|
||||
case 0x10://WM_CLOSE
|
||||
Close();
|
||||
break;
|
||||
|
||||
case 0x2://WM_DESTROY
|
||||
EnableWindow(_activeWindow, true);
|
||||
_continueLoop = false;
|
||||
@ -1393,8 +1367,7 @@ namespace Sunny.UI
|
||||
}
|
||||
}
|
||||
|
||||
private bool _disposed;
|
||||
|
||||
bool _disposed;
|
||||
/// <summary>
|
||||
/// 释放窗体
|
||||
/// </summary>
|
||||
@ -1512,7 +1485,6 @@ namespace Sunny.UI
|
||||
// ReSharper disable UnusedField.Compiler
|
||||
#pragma warning disable 414
|
||||
#pragma warning disable 649
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
|
||||
private class WNDCLASS
|
||||
{
|
||||
@ -1556,10 +1528,7 @@ namespace Sunny.UI
|
||||
|
||||
public static readonly PointOrSize Empty = new PointOrSize();
|
||||
|
||||
public PointOrSize()
|
||||
{
|
||||
XOrWidth = 0; YOrHeight = 0;
|
||||
}
|
||||
public PointOrSize() { XOrWidth = 0; YOrHeight = 0; }
|
||||
|
||||
public PointOrSize(int xOrWidth, int yOrHeight)
|
||||
{
|
||||
@ -1574,8 +1543,7 @@ namespace Sunny.UI
|
||||
// ReSharper restore NotAccessedField.Local
|
||||
#pragma warning restore 649
|
||||
#pragma warning restore 414
|
||||
|
||||
#endregion Win32 API
|
||||
#endregion
|
||||
}
|
||||
|
||||
internal static class GraphicsUtils
|
||||
@ -1718,7 +1686,8 @@ namespace Sunny.UI
|
||||
/// <param name="border">边框描述对象。对象无效则不描边</param>
|
||||
public static void DrawPath(Graphics g, GraphicsPath path, Brush brush = null, Border border = null)
|
||||
{
|
||||
if (border != null && Border.IsValid(border) && border.Behind)
|
||||
if (border == null) return;
|
||||
if (Border.IsValid(border) && border.Behind)
|
||||
{
|
||||
g.DrawPath(border.Pen, path);
|
||||
}
|
||||
@ -1726,12 +1695,13 @@ namespace Sunny.UI
|
||||
{
|
||||
g.FillPath(brush, path);
|
||||
}
|
||||
if (border != null && Border.IsValid(border) && !border.Behind)
|
||||
if (Border.IsValid(border) && !border.Behind)
|
||||
{
|
||||
g.DrawPath(border.Pen, path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 阴影生成类
|
||||
/// </summary>
|
||||
@ -1744,11 +1714,10 @@ namespace Sunny.UI
|
||||
* - 减少运算量
|
||||
* =================================================================================
|
||||
*/
|
||||
|
||||
private static class DropShadow
|
||||
{
|
||||
private const int CHANNELS = 4;
|
||||
private const int InflateMultiple = 2;//单边外延radius的倍数
|
||||
const int CHANNELS = 4;
|
||||
const int InflateMultiple = 2;//单边外延radius的倍数
|
||||
|
||||
/// <summary>
|
||||
/// 获取阴影边界。供外部定位阴影用
|
||||
@ -1853,7 +1822,6 @@ namespace Sunny.UI
|
||||
#if UNSAFE
|
||||
private static unsafe void BoxBlur(BitmapData data, int radius, Color color)
|
||||
#else
|
||||
|
||||
private static void BoxBlur(BitmapData data, int radius, Color color)
|
||||
#endif
|
||||
{
|
||||
@ -1955,22 +1923,22 @@ namespace Sunny.UI
|
||||
#endif
|
||||
}
|
||||
|
||||
//private static int[] DetermineBoxes(double Sigma, int BoxCount)
|
||||
//{
|
||||
// double IdealWidth = Math.Sqrt((12 * Sigma * Sigma / BoxCount) + 1);
|
||||
// int Lower = (int)Math.Floor(IdealWidth);
|
||||
// if (Lower % 2 == 0)
|
||||
// Lower--;
|
||||
// int Upper = Lower + 2;
|
||||
|
||||
// double MedianWidth = (12 * Sigma * Sigma - BoxCount * Lower * Lower - 4 * BoxCount * Lower - 3 * BoxCount) / (-4 * Lower - 4);
|
||||
// int Median = (int)Math.Round(MedianWidth);
|
||||
|
||||
// int[] BoxSizes = new int[BoxCount];
|
||||
// for (int i = 0; i < BoxCount; i++)
|
||||
// BoxSizes[i] = (i < Median) ? Lower : Upper;
|
||||
// return BoxSizes;
|
||||
//}
|
||||
// private static int[] DetermineBoxes(double Sigma, int BoxCount)
|
||||
// {
|
||||
// double IdealWidth = Math.Sqrt((12 * Sigma * Sigma / BoxCount) + 1);
|
||||
// int Lower = (int)Math.Floor(IdealWidth);
|
||||
// if (Lower % 2 == 0)
|
||||
// Lower--;
|
||||
// int Upper = Lower + 2;
|
||||
//
|
||||
// double MedianWidth = (12 * Sigma * Sigma - BoxCount * Lower * Lower - 4 * BoxCount * Lower - 3 * BoxCount) / (-4 * Lower - 4);
|
||||
// int Median = (int)Math.Round(MedianWidth);
|
||||
//
|
||||
// int[] BoxSizes = new int[BoxCount];
|
||||
// for (int i = 0; i < BoxCount; i++)
|
||||
// BoxSizes[i] = (i < Median) ? Lower : Upper;
|
||||
// return BoxSizes;
|
||||
// }
|
||||
}
|
||||
|
||||
#region Win32 API
|
||||
@ -1981,6 +1949,6 @@ namespace Sunny.UI
|
||||
[DllImport("user32.dll")]
|
||||
private static extern bool ReleaseDC(IntPtr hWnd, IntPtr hDC);
|
||||
|
||||
#endregion Win32 API
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -152,6 +152,7 @@
|
||||
<Compile Include="Controls\UIWaitingBar.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\UIFormService.cs" />
|
||||
<Compile Include="Forms\UILoginForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@ -220,6 +221,12 @@
|
||||
<Compile Include="Forms\UIInputForm.Designer.cs">
|
||||
<DependentUpon>UIInputForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\UIWaitForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\UIWaitForm.designer.cs">
|
||||
<DependentUpon>UIWaitForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Frames\UIAsideMainFrame.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@ -514,6 +521,9 @@
|
||||
<EmbeddedResource Include="Font\UIFontImages.resx">
|
||||
<DependentUpon>UIFontImages.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\UIWaitForm.resx">
|
||||
<DependentUpon>UIWaitForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
|
Loading…
x
Reference in New Issue
Block a user