Skip to content

Commit

Permalink
停止滚动时处理
Browse files Browse the repository at this point in the history
  • Loading branch information
kwwwvagaa committed Aug 13, 2020
1 parent d4c5076 commit 474c5a7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
14 changes: 11 additions & 3 deletions HZH_Controls/HZH_Controls/Controls/Process/UCProcessRoll.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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("自定义")]
Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion HZH_Controls/Test/UC/UCTestProcess.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 474c5a7

Please sign in to comment.