protected override void OnPaint(PaintEventArgs e) { Rectangle rec = new Rectangle(0, 0, this.Width, this.Height); GraphicsPathHelper.Draw(rec, e.Graphics, radius, false, BackColor); base.OnPaint(e); Graphics g = e.Graphics; if (_animationManager.IsAnimating()) { g.SmoothingMode = SmoothingMode.AntiAlias; Color bg = BackColor.TakeBackColor();//取相反色 using (SolidBrush hrush = new SolidBrush(Color.FromArgb(50, bg))) { float animationValue = (float)_animationManager.GetProgress(); float x = _animationManager.GetMouseDown().X - animationValue / 2; float y = _animationManager.GetMouseDown().Y - animationValue / 2; RectangleF rect = new RectangleF(x, y, animationValue, animationValue); g.FillEllipse(hrush, rect); } g.SmoothingMode = SmoothingMode.None; } DrawImage(e.Graphics); DrawText(e.Graphics); }
protected override void OnPaint(PaintEventArgs e) { Rectangle rec = new Rectangle(0, 0, this.Width, this.Height); GraphicsPathHelper.Draw(rec, e.Graphics, radius, false, beginColor, endColor); base.OnPaint(e); Graphics g = e.Graphics; DrawImage(e.Graphics); DrawText(e.Graphics); }
protected override void OnPaint(PaintEventArgs e) { if (!base.Visible) { return; } //base.OnPaint(e); Graphics g = e.Graphics; Rectangle rect = Rectangle.Empty; switch (errorAlignment) { case ErrorAlignment.Top: rect = new Rectangle(0, 0, this.Width, this.Height - (TriangleHeight - 2)); break; case ErrorAlignment.Right: //TriangleWidth = 15; rect = new Rectangle(TriangleWidth - 2, 0, this.Width, this.Height); break; case ErrorAlignment.Left: rect = new Rectangle(0, 0, this.Width - TriangleWidth + 4, this.Height); break; case ErrorAlignment.Bottom: rect = new Rectangle(0, TriangleHeight - 2, this.Width, this.Height); break; default: break; } //绘制背景 GraphicsPathHelper.Draw(rect, g, 18, false, backColor); DrawTriangle(g); DrawText(g, rect); }