diff --git a/SunnyUI.Demo/FMain.cs b/SunnyUI.Demo/FMain.cs index a68293f0..1d83ff6c 100644 --- a/SunnyUI.Demo/FMain.cs +++ b/SunnyUI.Demo/FMain.cs @@ -6,10 +6,10 @@ using System.Windows.Forms; namespace Sunny.UI.Demo { /// - /// Windows10、Windows11 建议用UIForm2,更接近原生窗体使用体验,用UIForm也可以 - /// WindowsXP、Windows7 建议使用UIForm + /// WindowsXP、Windows7、Windows10、Windows11 建议使用 UIForm + /// Windows10、Windows11 可尝试使用 UIForm2,更接近原生窗体使用体验,用 UIForm 也可以 /// - public partial class FMain : UIForm2 + public partial class FMain : UIForm { public FMain() { @@ -115,6 +115,7 @@ namespace Sunny.UI.Demo uiNavMenu1.SelectPage(1002); uiPanel2.Text = Text = Version; + //设置全局热键 RegisterHotKey(UI.ModifierKeys.Shift, Keys.F8); //根据页面类型获取页面 @@ -176,6 +177,11 @@ namespace Sunny.UI.Demo Process.Start("https://gitee.com/yhuse/SunnyUI"); } + /// + /// 全局热键事件 + /// + /// + /// private void Form1_HotKeyEventHandler(object sender, HotKeyEventArgs e) { if (e.hotKey.ModifierKey == UI.ModifierKeys.Shift && e.hotKey.Key == Keys.F8) diff --git a/SunnyUI.Demo/Industrial/FLed.Designer.cs b/SunnyUI.Demo/Industrial/FLed.Designer.cs index c3eb64ac..4fa2cab2 100644 --- a/SunnyUI.Demo/Industrial/FLed.Designer.cs +++ b/SunnyUI.Demo/Industrial/FLed.Designer.cs @@ -56,6 +56,7 @@ namespace Sunny.UI.Demo this.uiDigitalLabel2 = new Sunny.UI.UIDigitalLabel(); this.uiDigitalLabel1 = new Sunny.UI.UIDigitalLabel(); this.uiLine4 = new Sunny.UI.UILine(); + this.uiBattery7 = new Sunny.UI.UIBattery(); this.SuspendLayout(); // // uiBattery6 @@ -170,7 +171,7 @@ namespace Sunny.UI.Demo this.uiLedStopwatch1.Name = "uiLedStopwatch1"; this.uiLedStopwatch1.Size = new System.Drawing.Size(190, 34); this.uiLedStopwatch1.TabIndex = 61; - this.uiLedStopwatch1.Text = "12:50"; + this.uiLedStopwatch1.Text = "01:05"; // // uiLedDisplay1 // @@ -359,11 +360,25 @@ namespace Sunny.UI.Demo this.uiLine4.Text = "UIDigitalLabel"; this.uiLine4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // + // uiBattery7 + // + this.uiBattery7.Font = new System.Drawing.Font("宋体", 12F); + this.uiBattery7.Location = new System.Drawing.Point(42, 410); + this.uiBattery7.MinimumSize = new System.Drawing.Size(1, 1); + this.uiBattery7.Name = "uiBattery7"; + this.uiBattery7.Size = new System.Drawing.Size(73, 105); + this.uiBattery7.SymbolOffset = new System.Drawing.Point(1, 3); + this.uiBattery7.SymbolRotate = 270; + this.uiBattery7.SymbolSize = 100; + this.uiBattery7.TabIndex = 110; + this.uiBattery7.Text = "uiBattery7"; + // // FLed // this.AllowShowTitle = true; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.ClientSize = new System.Drawing.Size(800, 555); + this.Controls.Add(this.uiBattery7); this.Controls.Add(this.uiLine4); this.Controls.Add(this.uiDigitalLabel2); this.Controls.Add(this.uiDigitalLabel1); @@ -426,5 +441,6 @@ namespace Sunny.UI.Demo private UIDigitalLabel uiDigitalLabel2; private UIDigitalLabel uiDigitalLabel1; private UILine uiLine4; + private UIBattery uiBattery7; } } \ No newline at end of file diff --git a/SunnyUI.Demo/Industrial/FLed.cs b/SunnyUI.Demo/Industrial/FLed.cs index c4f64433..6ba8cd7e 100644 --- a/SunnyUI.Demo/Industrial/FLed.cs +++ b/SunnyUI.Demo/Industrial/FLed.cs @@ -19,7 +19,7 @@ private void timer1_Tick(object sender, System.EventArgs e) { value++; - uiBattery1.Power = value; + uiBattery7.Power = uiBattery1.Power = value; uiLedDisplay1.Text = value + " Ω"; uiDigitalLabel2.Value += 0.1; } diff --git a/SunnyUI.Demo/Industrial/FLight.Designer.cs b/SunnyUI.Demo/Industrial/FLight.Designer.cs index 2a09bcae..4434bdac 100644 --- a/SunnyUI.Demo/Industrial/FLight.Designer.cs +++ b/SunnyUI.Demo/Industrial/FLight.Designer.cs @@ -45,6 +45,12 @@ namespace Sunny.UI.Demo this.uiLedBulb6 = new Sunny.UI.UILedBulb(); this.uiLight5 = new Sunny.UI.UILight(); this.uiLight6 = new Sunny.UI.UILight(); + this.uiStatusBox1 = new Sunny.UI.UIStatusBox(); + this.uiLine1 = new Sunny.UI.UILine(); + this.uiButton1 = new Sunny.UI.UIButton(); + this.uiButton2 = new Sunny.UI.UIButton(); + this.uiButton3 = new Sunny.UI.UIButton(); + ((System.ComponentModel.ISupportInitialize)(this.uiStatusBox1)).BeginInit(); this.SuspendLayout(); // // uiLedBulb4 @@ -78,7 +84,9 @@ namespace Sunny.UI.Demo // // uiLine8 // + this.uiLine8.BackColor = System.Drawing.Color.Transparent; this.uiLine8.Font = new System.Drawing.Font("宋体", 12F); + this.uiLine8.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); this.uiLine8.Location = new System.Drawing.Point(381, 55); this.uiLine8.MinimumSize = new System.Drawing.Size(16, 16); this.uiLine8.Name = "uiLine8"; @@ -144,7 +152,9 @@ namespace Sunny.UI.Demo // // uiLine2 // + this.uiLine2.BackColor = System.Drawing.Color.Transparent; this.uiLine2.Font = new System.Drawing.Font("宋体", 12F); + this.uiLine2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); this.uiLine2.Location = new System.Drawing.Point(30, 55); this.uiLine2.MinimumSize = new System.Drawing.Size(16, 16); this.uiLine2.Name = "uiLine2"; @@ -223,11 +233,113 @@ namespace Sunny.UI.Demo this.uiLight6.TabIndex = 75; this.uiLight6.Text = "uiLight6"; // + // uiStatusBox1 + // + this.uiStatusBox1.Image = global::Sunny.UI.Demo.Properties.Resources.led_g; + this.uiStatusBox1.Location = new System.Drawing.Point(30, 272); + this.uiStatusBox1.Name = "uiStatusBox1"; + this.uiStatusBox1.Size = new System.Drawing.Size(36, 36); + this.uiStatusBox1.Status1 = global::Sunny.UI.Demo.Properties.Resources.led_g; + this.uiStatusBox1.Status2 = global::Sunny.UI.Demo.Properties.Resources.led_y; + this.uiStatusBox1.Status3 = global::Sunny.UI.Demo.Properties.Resources.led_r; + this.uiStatusBox1.TabIndex = 77; + this.uiStatusBox1.TabStop = false; + // + // uiLine1 + // + this.uiLine1.BackColor = System.Drawing.Color.Transparent; + this.uiLine1.Font = new System.Drawing.Font("宋体", 12F); + this.uiLine1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); + this.uiLine1.Location = new System.Drawing.Point(30, 230); + this.uiLine1.MinimumSize = new System.Drawing.Size(16, 16); + this.uiLine1.Name = "uiLine1"; + this.uiLine1.Size = new System.Drawing.Size(319, 20); + this.uiLine1.TabIndex = 79; + this.uiLine1.Text = "UILight"; + this.uiLine1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // uiButton1 + // + this.uiButton1.Cursor = System.Windows.Forms.Cursors.Hand; + this.uiButton1.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(110)))), ((int)(((byte)(190)))), ((int)(((byte)(40))))); + this.uiButton1.FillColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(110)))), ((int)(((byte)(190)))), ((int)(((byte)(40))))); + this.uiButton1.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(139)))), ((int)(((byte)(203)))), ((int)(((byte)(83))))); + this.uiButton1.FillPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(88)))), ((int)(((byte)(152)))), ((int)(((byte)(32))))); + this.uiButton1.FillSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(88)))), ((int)(((byte)(152)))), ((int)(((byte)(32))))); + this.uiButton1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.uiButton1.LightColor = System.Drawing.Color.FromArgb(((int)(((byte)(245)))), ((int)(((byte)(251)))), ((int)(((byte)(241))))); + this.uiButton1.Location = new System.Drawing.Point(78, 273); + this.uiButton1.MinimumSize = new System.Drawing.Size(1, 1); + this.uiButton1.Name = "uiButton1"; + this.uiButton1.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(110)))), ((int)(((byte)(190)))), ((int)(((byte)(40))))); + this.uiButton1.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(139)))), ((int)(((byte)(203)))), ((int)(((byte)(83))))); + this.uiButton1.RectPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(88)))), ((int)(((byte)(152)))), ((int)(((byte)(32))))); + this.uiButton1.RectSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(88)))), ((int)(((byte)(152)))), ((int)(((byte)(32))))); + this.uiButton1.Size = new System.Drawing.Size(75, 35); + this.uiButton1.Style = Sunny.UI.UIStyle.Custom; + this.uiButton1.TabIndex = 80; + this.uiButton1.Text = "切换"; + this.uiButton1.TipsFont = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.uiButton1.Click += new System.EventHandler(this.uiButton1_Click); + // + // uiButton2 + // + this.uiButton2.Cursor = System.Windows.Forms.Cursors.Hand; + this.uiButton2.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(155)))), ((int)(((byte)(40))))); + this.uiButton2.FillColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(155)))), ((int)(((byte)(40))))); + this.uiButton2.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(227)))), ((int)(((byte)(175)))), ((int)(((byte)(83))))); + this.uiButton2.FillPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(176)))), ((int)(((byte)(124)))), ((int)(((byte)(32))))); + this.uiButton2.FillSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(176)))), ((int)(((byte)(124)))), ((int)(((byte)(32))))); + this.uiButton2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.uiButton2.LightColor = System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(249)))), ((int)(((byte)(241))))); + this.uiButton2.Location = new System.Drawing.Point(159, 273); + this.uiButton2.MinimumSize = new System.Drawing.Size(1, 1); + this.uiButton2.Name = "uiButton2"; + this.uiButton2.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(155)))), ((int)(((byte)(40))))); + this.uiButton2.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(227)))), ((int)(((byte)(175)))), ((int)(((byte)(83))))); + this.uiButton2.RectPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(176)))), ((int)(((byte)(124)))), ((int)(((byte)(32))))); + this.uiButton2.RectSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(176)))), ((int)(((byte)(124)))), ((int)(((byte)(32))))); + this.uiButton2.Size = new System.Drawing.Size(75, 35); + this.uiButton2.Style = Sunny.UI.UIStyle.Custom; + this.uiButton2.TabIndex = 81; + this.uiButton2.Text = "切换"; + this.uiButton2.TipsFont = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.uiButton2.Click += new System.EventHandler(this.uiButton2_Click); + // + // uiButton3 + // + this.uiButton3.Cursor = System.Windows.Forms.Cursors.Hand; + this.uiButton3.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80))))); + this.uiButton3.FillColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80))))); + this.uiButton3.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(115)))), ((int)(((byte)(115))))); + this.uiButton3.FillPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(184)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.uiButton3.FillSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(184)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.uiButton3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.uiButton3.LightColor = System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(243)))), ((int)(((byte)(243))))); + this.uiButton3.Location = new System.Drawing.Point(240, 273); + this.uiButton3.MinimumSize = new System.Drawing.Size(1, 1); + this.uiButton3.Name = "uiButton3"; + this.uiButton3.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80))))); + this.uiButton3.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(115)))), ((int)(((byte)(115))))); + this.uiButton3.RectPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(184)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.uiButton3.RectSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(184)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.uiButton3.Size = new System.Drawing.Size(75, 35); + this.uiButton3.Style = Sunny.UI.UIStyle.Custom; + this.uiButton3.TabIndex = 82; + this.uiButton3.Text = "切换"; + this.uiButton3.TipsFont = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.uiButton3.Click += new System.EventHandler(this.uiButton3_Click); + // // FLight // this.AllowShowTitle = true; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.uiButton3); + this.Controls.Add(this.uiButton2); + this.Controls.Add(this.uiButton1); + this.Controls.Add(this.uiLine1); + this.Controls.Add(this.uiStatusBox1); this.Controls.Add(this.uiLight5); this.Controls.Add(this.uiLight6); this.Controls.Add(this.uiLedBulb5); @@ -247,6 +359,7 @@ namespace Sunny.UI.Demo this.ShowTitle = true; this.Symbol = 362751; this.Text = "Light"; + ((System.ComponentModel.ISupportInitialize)(this.uiStatusBox1)).EndInit(); this.ResumeLayout(false); } @@ -267,5 +380,10 @@ namespace Sunny.UI.Demo private UILedBulb uiLedBulb6; private UILight uiLight5; private UILight uiLight6; + private UIStatusBox uiStatusBox1; + private UILine uiLine1; + private UIButton uiButton1; + private UIButton uiButton2; + private UIButton uiButton3; } } \ No newline at end of file diff --git a/SunnyUI.Demo/Industrial/FLight.cs b/SunnyUI.Demo/Industrial/FLight.cs index cbcc584c..3fc37624 100644 --- a/SunnyUI.Demo/Industrial/FLight.cs +++ b/SunnyUI.Demo/Industrial/FLight.cs @@ -6,5 +6,27 @@ { InitializeComponent(); } + + public enum LightState + { + Green = 1, + Yellow = 2, + Red = 3 + } + + private void uiButton1_Click(object sender, System.EventArgs e) + { + uiStatusBox1.Status = (int)LightState.Green; + } + + private void uiButton2_Click(object sender, System.EventArgs e) + { + uiStatusBox1.Status = (int)LightState.Yellow; + } + + private void uiButton3_Click(object sender, System.EventArgs e) + { + uiStatusBox1.Status = (int)LightState.Red; + } } } diff --git a/SunnyUI.Demo/Properties/Resources.Designer.cs b/SunnyUI.Demo/Properties/Resources.Designer.cs index 21069752..2aa1ddcf 100644 --- a/SunnyUI.Demo/Properties/Resources.Designer.cs +++ b/SunnyUI.Demo/Properties/Resources.Designer.cs @@ -470,6 +470,36 @@ namespace Sunny.UI.Demo.Properties { } } + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap led_g { + get { + object obj = ResourceManager.GetObject("led_g", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap led_r { + get { + object obj = ResourceManager.GetObject("led_r", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap led_y { + get { + object obj = ResourceManager.GetObject("led_y", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// diff --git a/SunnyUI.Demo/Properties/Resources.resx b/SunnyUI.Demo/Properties/Resources.resx index 048eb00e..be9aae64 100644 --- a/SunnyUI.Demo/Properties/Resources.resx +++ b/SunnyUI.Demo/Properties/Resources.resx @@ -214,6 +214,15 @@ ..\Resources\lazio.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\led_g.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\led_r.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\led_y.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\mallorca.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a diff --git a/SunnyUI.Demo/Resources/led_g.png b/SunnyUI.Demo/Resources/led_g.png new file mode 100644 index 00000000..f644a096 Binary files /dev/null and b/SunnyUI.Demo/Resources/led_g.png differ diff --git a/SunnyUI.Demo/Resources/led_r.png b/SunnyUI.Demo/Resources/led_r.png new file mode 100644 index 00000000..dbb24bf3 Binary files /dev/null and b/SunnyUI.Demo/Resources/led_r.png differ diff --git a/SunnyUI.Demo/Resources/led_y.png b/SunnyUI.Demo/Resources/led_y.png new file mode 100644 index 00000000..4da08ded Binary files /dev/null and b/SunnyUI.Demo/Resources/led_y.png differ diff --git a/SunnyUI.Demo/SunnyUI.Demo.csproj b/SunnyUI.Demo/SunnyUI.Demo.csproj index 824a7f6e..bf2c70d4 100644 --- a/SunnyUI.Demo/SunnyUI.Demo.csproj +++ b/SunnyUI.Demo/SunnyUI.Demo.csproj @@ -775,6 +775,9 @@ + + +