using System using System Collections Generic using System ComponentMo

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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;
using System.Timers;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
Matrix mat = new Matrix(0f, 1f, -1f, 0f, 0f, 0f);
Point[] pt = new Point[3] { new Point(0, 0), new Point(100, 0), new Point(100, 100)};
public Form1()
{
InitializeComponent();
timer1.Interval = 500;
timer1.Start();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
g.TranslateTransform(this.ClientRectangle.Width / 2, this.ClientRectangle.Height / 2);
mat.TransformPoints(pt);
g.DrawPolygon(new Pen(Color.Black, 10), pt);
}
private void timer1_Tick(object sender, EventArgs e)
{
this.Invalidate();
}
}
}