diff --git a/Bin/SunnyUI.Demo.exe b/Bin/SunnyUI.Demo.exe index b7b00f09..c024d19a 100644 Binary files a/Bin/SunnyUI.Demo.exe and b/Bin/SunnyUI.Demo.exe differ diff --git a/Bin/SunnyUI.dll b/Bin/SunnyUI.dll index 42031739..5511e88b 100644 Binary files a/Bin/SunnyUI.dll and b/Bin/SunnyUI.dll differ diff --git a/SunnyUI.Demo/Controls/FOther.Designer.cs b/SunnyUI.Demo/Controls/FOther.Designer.cs index 64468f76..f5787eeb 100644 --- a/SunnyUI.Demo/Controls/FOther.Designer.cs +++ b/SunnyUI.Demo/Controls/FOther.Designer.cs @@ -56,11 +56,13 @@ this.uiLabel2 = new Sunny.UI.UILabel(); this.uiLabel3 = new Sunny.UI.UILabel(); this.uiToolTip1 = new Sunny.UI.UIToolTip(this.components); + this.uiProcessBar2 = new Sunny.UI.UIProcessBar(); this.PagePanel.SuspendLayout(); this.SuspendLayout(); // // PagePanel // + this.PagePanel.Controls.Add(this.uiProcessBar2); this.PagePanel.Controls.Add(this.uiLabel3); this.PagePanel.Controls.Add(this.uiLabel2); this.PagePanel.Controls.Add(this.uiLabel1); @@ -141,11 +143,12 @@ // this.uiProcessBar1.Font = new System.Drawing.Font("微软雅黑", 12F); this.uiProcessBar1.Location = new System.Drawing.Point(30, 136); - this.uiProcessBar1.MinimumSize = new System.Drawing.Size(70, 23); + this.uiProcessBar1.MinimumSize = new System.Drawing.Size(70, 1); this.uiProcessBar1.Name = "uiProcessBar1"; - this.uiProcessBar1.Size = new System.Drawing.Size(319, 29); + this.uiProcessBar1.Size = new System.Drawing.Size(318, 29); this.uiProcessBar1.TabIndex = 24; - this.uiProcessBar1.Text = "0.0%"; + this.uiProcessBar1.Text = "50.0%"; + this.uiProcessBar1.Value = 50; // // uiLine3 // @@ -262,6 +265,7 @@ this.uiLedBulb4.BlinkInterval = 500; this.uiLedBulb4.Location = new System.Drawing.Point(507, 52); this.uiLedBulb4.Name = "uiLedBulb4"; + this.uiLedBulb4.On = false; this.uiLedBulb4.Size = new System.Drawing.Size(32, 32); this.uiLedBulb4.TabIndex = 41; this.uiLedBulb4.Text = "uiLedBulb4"; @@ -377,6 +381,17 @@ this.uiToolTip1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(239)))), ((int)(((byte)(239)))), ((int)(((byte)(239))))); this.uiToolTip1.OwnerDraw = true; // + // uiProcessBar2 + // + this.uiProcessBar2.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiProcessBar2.Location = new System.Drawing.Point(30, 171); + this.uiProcessBar2.MinimumSize = new System.Drawing.Size(70, 1); + this.uiProcessBar2.Name = "uiProcessBar2"; + this.uiProcessBar2.Size = new System.Drawing.Size(318, 5); + this.uiProcessBar2.TabIndex = 56; + this.uiProcessBar2.Text = "50.0%"; + this.uiProcessBar2.Value = 50; + // // FOther // this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F); @@ -419,5 +434,6 @@ private UILabel uiLabel2; private UILabel uiLabel1; private UIToolTip uiToolTip1; + private UIProcessBar uiProcessBar2; } } \ No newline at end of file diff --git a/SunnyUI.Demo/Controls/FOther.cs b/SunnyUI.Demo/Controls/FOther.cs index b2a97360..e2ec1b8a 100644 --- a/SunnyUI.Demo/Controls/FOther.cs +++ b/SunnyUI.Demo/Controls/FOther.cs @@ -1,6 +1,4 @@ -using System.Drawing; - -namespace Sunny.UI.Demo +namespace Sunny.UI.Demo { public partial class FOther : UITitlePage { @@ -9,8 +7,8 @@ namespace Sunny.UI.Demo InitializeComponent(); uiToolTip1.SetToolTip(uiLabel2, "赠人玫瑰手有余香", "SunnyUI"); - uiToolTip1.SetToolTip(uiLabel3, "赠人玫瑰手有余香"+'\n'+ "赠人玫瑰手有余香", - "SunnyUI", 61530,32,UIColor.Green); + uiToolTip1.SetToolTip(uiLabel3, "赠人玫瑰手有余香" + '\n' + "赠人玫瑰手有余香", + "SunnyUI", 61530, 32, UIColor.Green); } private int value; @@ -25,7 +23,7 @@ namespace Sunny.UI.Demo { value++; uiTrackBar1.Value = value; - uiProcessBar1.Value = value; + uiProcessBar2.Value = uiProcessBar1.Value = value; } } } \ No newline at end of file diff --git a/SunnyUI/Controls/UIProcessBar.cs b/SunnyUI/Controls/UIProcessBar.cs index 8dfed4e1..11dfdb95 100644 --- a/SunnyUI/Controls/UIProcessBar.cs +++ b/SunnyUI/Controls/UIProcessBar.cs @@ -41,7 +41,7 @@ namespace Sunny.UI public UIProcessBar() { - MinimumSize = new Size(70, 23); + MinimumSize = new Size(70, 5); Size = new Size(300, 29); ShowText = false; @@ -113,7 +113,10 @@ namespace Sunny.UI { base.OnPaint(e); - if (ShowValue) + SizeF sf = e.Graphics.MeasureString(processText, Font); + bool canShow = Height > sf.Height + 4; + + if (ShowValue && canShow) { e.Graphics.DrawString(processText, Font, foreColor, Size, Padding, TextAlign); } @@ -132,7 +135,7 @@ namespace Sunny.UI g.SetHighQuality(); g.FillRoundRectangle(rectColor, rect, Radius); g.DrawRoundRectangle(rectColor, rect, Radius); - if (ShowValue) + if (ShowValue && canShow) { g.DrawString(processText, Font, fillColor, Size, Padding, TextAlign); }