From 474c5a7ac3e1d170948851e490ed4ae97598e187 Mon Sep 17 00:00:00 2001 From: kwwwvagaa <623128629@qq.com> Date: Thu, 13 Aug 2020 10:55:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=81=9C=E6=AD=A2=E6=BB=9A=E5=8A=A8=E6=97=B6?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HZH_Controls/Controls/Process/UCProcessRoll.cs | 14 +++++++++++--- HZH_Controls/Test/UC/UCTestProcess.Designer.cs | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/HZH_Controls/HZH_Controls/Controls/Process/UCProcessRoll.cs b/HZH_Controls/HZH_Controls/Controls/Process/UCProcessRoll.cs index 4181ad9..226840b 100644 --- a/HZH_Controls/HZH_Controls/Controls/Process/UCProcessRoll.cs +++ b/HZH_Controls/HZH_Controls/Controls/Process/UCProcessRoll.cs @@ -24,7 +24,15 @@ public Color RollColor public bool Roll { get { return timer.Enabled; } - set { timer.Enabled = value; } + set + { + timer.Enabled = value; + if (!value) + { + workRect = new Rectangle(-this.Width / 3, 0, this.Width / 3, this.Height); + Invalidate(); + } + } } [Description("滚动间隔时间"), Category("自定义")] @@ -65,11 +73,11 @@ protected override void OnPaint(PaintEventArgs e) base.OnPaint(e); var g = e.Graphics; g.SetGDIHigh(); - var r1 = new RectangleF(new Point(workRect.Left - 1, workRect.Top), new Size(workRect.Width / 3+1, workRect.Height)); + var r1 = new RectangleF(new Point(workRect.Left - 1, workRect.Top), new Size(workRect.Width / 3 + 1, workRect.Height)); var r2 = new RectangleF(new Point(workRect.Right - workRect.Width / 3, workRect.Top), new Size(workRect.Width / 3, workRect.Height)); LinearGradientBrush lgb1 = new LinearGradientBrush(r1, Color.FromArgb(0, rollColor), rollColor, 0f); LinearGradientBrush lgb2 = new LinearGradientBrush(r2, rollColor, Color.FromArgb(0, rollColor), 0f); - g.FillRectangle(lgb1, new Rectangle(new Point(workRect.Left , workRect.Top), new Size(workRect.Width / 3, workRect.Height))); + g.FillRectangle(lgb1, new Rectangle(new Point(workRect.Left, workRect.Top), new Size(workRect.Width / 3, workRect.Height))); g.FillRectangle(new SolidBrush(rollColor), new RectangleF(workRect.Left + workRect.Width / 3 - 1, workRect.Top, workRect.Width / 3 + 3, workRect.Height)); g.FillRectangle(lgb2, r2); } diff --git a/HZH_Controls/Test/UC/UCTestProcess.Designer.cs b/HZH_Controls/Test/UC/UCTestProcess.Designer.cs index ee87c6a..25d56ea 100644 --- a/HZH_Controls/Test/UC/UCTestProcess.Designer.cs +++ b/HZH_Controls/Test/UC/UCTestProcess.Designer.cs @@ -55,7 +55,7 @@ private void InitializeComponent() // ucProcessRoll1 // this.ucProcessRoll1.BackColor = System.Drawing.Color.White; - this.ucProcessRoll1.Location = new System.Drawing.Point(34, 658); + this.ucProcessRoll1.Location = new System.Drawing.Point(34, 653); this.ucProcessRoll1.Name = "ucProcessRoll1"; this.ucProcessRoll1.Roll = true; this.ucProcessRoll1.RollColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(122)))), ((int)(((byte)(204)))));