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 DrawOnBitmap
{
    public partial class frm25DrawOnBitmap : Form
    {
        public frm25DrawOnBitmap()
        {
            InitializeComponent();
        }

        // Make and display a Bitmap.
        private void frm25DrawOnBitmap_Load(object sender, EventArgs e)
        {
            drawingPictureBox.SizeMode = PictureBoxSizeMode.AutoSize;
            drawingPictureBox.Location = new Point(0, 0);

            Bitmap bm = new Bitmap(280, 110);
            using (Graphics gr = Graphics.FromImage(bm))
            {
                gr.Clear(Color.White);
                gr.SmoothingMode = SmoothingMode.AntiAlias;
                Rectangle rect = new Rectangle(10, 10, 260, 90);
                gr.FillEllipse(Brushes.LightGreen, rect);
                using (Pen pen = new Pen(Color.Blue, 5))
                {
                    gr.DrawEllipse(pen, rect);
                }
            }

            drawingPictureBox.Image = bm;
            bm.Dispose();
        }


        /// <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.drawingPictureBox = new System.Windows.Forms.PictureBox();
            ((System.ComponentModel.ISupportInitialize)(this.drawingPictureBox)).BeginInit();
            this.SuspendLayout();
            // 
            // picDrawing
            // 
            this.drawingPictureBox.Location = new System.Drawing.Point(12, 12);
            this.drawingPictureBox.Name = "picDrawing";
            this.drawingPictureBox.Size = new System.Drawing.Size(260, 90);
            this.drawingPictureBox.TabIndex = 1;
            this.drawingPictureBox.TabStop = false;
            // 
            // frm25DrawOnBitmap
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(284, 114);
            this.Controls.Add(this.drawingPictureBox);
            this.Name = "frm25DrawOnBitmap";
            this.Text = "DrawOnBitmap";
            this.Load += new System.EventHandler(this.frm25DrawOnBitmap_Load);
            ((System.ComponentModel.ISupportInitialize)(this.drawingPictureBox)).EndInit();
            this.ResumeLayout(false);

        }

        #endregion

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