Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
1.1 kB
2
Indexable
Never
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            this.Text="Drawing a Rectangle inscribed with circle";
            this.Size = new Size(450, 400);
            this.Paint += new PaintEventHandler(Draw_Graphics);
        }
    public void Draw_Graphics(object sender,PaintEventArgs e)
    {
            System.Drawing.Graphics g;
            g = this.CreateGraphics();
            Pen p1 = new Pen(System.Drawing.Color.Red, 3);
            Pen p2 = new Pen(System.Drawing.Color.Blue, 3);
            Rectangle r = new Rectangle(100, 100, 50, 50);
            g.DrawRectangle(p1,r);
            g.DrawEllipse(p2, 100, 100, 50, 50);
    }

        private void Form1_Load(object sender, EventArgs e)
        {
           
        }
    }
}
Leave a Comment