using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

using System.Drawing.Drawing2D;

namespace DrawInPaint
{
    public partial class frm24DrawInPaint : Form
    {
        public frm24DrawInPaint()
        {
            InitializeComponent();
        }

        // Draw an ellipse.
        private void ellipsePictureBox_Paint(object sender, PaintEventArgs e)
        {
            Rectangle rect = new Rectangle(10, 10,
                ellipsePictureBox.ClientSize.Width - 20,
                ellipsePictureBox.ClientSize.Height - 20);
            DrawEllipse(e.Graphics, rect);
        }

        // Redraw the ellipse.
        private void ellipsePictureBox_Resize(object sender, EventArgs e)
        {
            ellipsePictureBox.Refresh();
        }

        // Draw the ellipse.
        private void DrawEllipse(Graphics gr, Rectangle rect)
        {
            gr.Clear(Color.White);
            gr.SmoothingMode = SmoothingMode.AntiAlias;

            gr.FillEllipse(Brushes.Pink, rect);
            using (Pen thick_pen = new Pen(Color.Blue, 5))
            {
                gr.DrawEllipse(thick_pen, rect);
            }
        }


        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.ellipsePictureBox = new System.Windows.Forms.PictureBox();
            ((System.ComponentModel.ISupportInitialize)(this.ellipsePictureBox)).BeginInit();
            this.SuspendLayout();
            // 
            // picEllipse
            // 
            this.ellipsePictureBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
            | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.ellipsePictureBox.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
            this.ellipsePictureBox.Location = new System.Drawing.Point(12, 12);
            this.ellipsePictureBox.Name = "picEllipse";
            this.ellipsePictureBox.Size = new System.Drawing.Size(260, 165);
            this.ellipsePictureBox.TabIndex = 1;
            this.ellipsePictureBox.TabStop = false;
            this.ellipsePictureBox.Paint += new System.Windows.Forms.PaintEventHandler(this.ellipsePictureBox_Paint);
            this.ellipsePictureBox.Resize += new System.EventHandler(this.ellipsePictureBox_Resize);
            // 
            // frm24DrawInPaint
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(284, 189);
            this.Controls.Add(this.ellipsePictureBox);
            this.Name = "frm24DrawInPaint";
            this.Text = "DrawInPaint";
            ((System.ComponentModel.ISupportInitialize)(this.ellipsePictureBox)).EndInit();
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.PictureBox ellipsePictureBox;
    }
}