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;
using System.Drawing;
namespace WindowsFormsApplication1
{
public
partial class graphics : Form
{
public
graphics()
{
InitializeComponent();
}
private
void graphics_Load(object
sender, EventArgs e)
{
}
private
void graphics_Paint(object
sender, PaintEventArgs e)
{
Graphics
g;
g = this.CreateGraphics();
Pen
p = new Pen(Brushes.Purple, 3);
g.DrawEllipse(p, 100,
100, 100, 100);
g.FillEllipse(Brushes.Plum, 200, 100, 100, 200);
g.DrawLine(p, new Point(100,
200), new Point(200,
100));
Point[]
p1 = new Point[5];
p1[0] = new Point(100,
50);
p1[1] = new Point(200,
100);
p1[2] = new Point(250,
100);
p1[3] = new Point(200,
50);
p1[4] = new Point(100,
250);
g.DrawPolygon(p, p1);
System.Drawing.Font f = new Font("Times New
Roman", 15, FontStyle.Bold);
StringFormat
f1 = new StringFormat(StringFormatFlags.NoClip);
StringFormat
f2 = new StringFormat(f1);
f1.LineAlignment = StringAlignment.Center;
f2.FormatFlags = StringFormatFlags.DirectionVertical;
f2.Alignment = StringAlignment.Far;
Rectangle
r=new Rectangle(100,100,100,100);
g.DrawRectangle(Pens.Brown, r);
g.DrawString("Hello world", f, Brushes.Red, r.X, r.Y, f1);
g.DrawString("Hai", f, Brushes.SlateBlue,
r.Left, r.Top, f2);
}
}
}