public CircleForm()
        {
            InitializeComponent();

            System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();
            path.AddEllipse(0, 0, 400, 400);
            Region region = new Region(path);

            pictureBox1.Region = region;
            pen               = new Pen(CurrentColor, size);
            bmp               = new Bitmap(pictureBox1.Width, pictureBox1.Height);
            circlePen         = new CirclePen();
            pen.StartCap      = pen.EndCap = System.Drawing.Drawing2D.LineCap.Round;
            pictureBox1.Image = bmp;
            g = Graphics.FromImage(pictureBox1.Image);
            g.SetClip(region, System.Drawing.Drawing2D.CombineMode.Replace);
            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
            g.Clear(Color.White);

            pic.Parent      = pictureBox1;
            pic.BackColor   = Color.Transparent;
            pic.SizeMode    = PictureBoxSizeMode.AutoSize;
            pic.BorderStyle = BorderStyle.FixedSingle;
            pic.Visible     = false;
        }
Ejemplo n.º 2
0
        public CircleForm()
        {
            InitializeComponent();

            System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();
            path.AddEllipse(0, 0, 400, 400);
            Region region = new Region(path);

            pictureBox1.Region = region;
            pen               = new Pen(CurrentColor, size);
            bmp               = new Bitmap(pictureBox1.Width, pictureBox1.Height);
            circlePen         = new CirclePen();
            pen.StartCap      = pen.EndCap = System.Drawing.Drawing2D.LineCap.Round;
            pictureBox1.Image = bmp;
            g = Graphics.FromImage(pictureBox1.Image);
            g.SetClip(region, System.Drawing.Drawing2D.CombineMode.Replace);
            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
            g.Clear(Color.White);
        }