using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
namespace ConsoleApplication1
{
class GDI04 : Form
{
Point[] pnt = new Point[5]; // 5각형
public GDI04()
{
this.Text = "GDI폴리곤";
this.Size = new Size(500, 500);
pnt[0] = new Point(80, 20);
pnt[1] = new Point(30, 50);
pnt[2] = new Point(50, 100);
pnt[3] = new Point(100, 100);
pnt[4] = new Point(130, 55);
}
static void Main(string[] args)
{
Application.Run(new GDI04());
}
protected override void OnPaint(PaintEventArgs e)
{
// 재정의 할 로직 작성
Graphics g = e.Graphics;
Pen P = new Pen(Color.Red, 3);
Brush brush = Brushes.Violet;
g.DrawPolygon(P,pnt);
g.FillPolygon(brush, pnt);
g.Dispose();
base.OnPaint(e);
}
}
}