Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Drawing;
- using System.Drawing.Drawing2D;
- using System.Windows.Forms;
- namespace R804MoverFigura
- {
- public partial class ElipseControl : UserControl
- {
- private GraphicsPath path = null;
- public ElipseControl()
- {
- InitializeComponent();
- }
- private void ActualizarPath()
- {
- path = new GraphicsPath();
- path.AddEllipse(this.ClientRectangle);
- this.Region = new Region(path);
- }
- protected override void OnPaint(PaintEventArgs e)
- {
- base.OnPaint(e);
- if (path != null)
- {
- e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
- e.Graphics.FillPath(new SolidBrush(this.BackColor), path);
- e.Graphics.DrawPath(new Pen(this.ForeColor, 4), path);
- }
- }
- protected override void OnResize(EventArgs e)
- {
- base.OnResize(e);
- ActualizarPath();
- Invalidate();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement