using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace rotateTriangle
{
public partial class Form1 : Form
{
static double angle = 5 * Math.PI / 180;
//Matrix b = new Matrix(0, 1, -1, 0, 0, 0);
Matrix b = new Matrix((float)Math.Cos(angle), (float)Math.Sin(angle), -(float)Math.Sin(angle), (float)Math.Cos(angle),0, 0);
Point[] square = new Point[4] { new Point(500, 500), new Point(550, 500), new Point(550, 550), new Point(500, 550) };
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics test = e.Graphics;
test.DrawLine(new Pen(Color.Black), square[0], square[1]);
test.DrawLine(new Pen(Color.Black), square[1], square[2]);
test.DrawLine(new Pen(Color.Black), square[2], square[3]);
test.DrawLine(new Pen(Color.Black), square[3], square[0]);
}
private void timer1_Tick(object sender, EventArgs e)
{
Invalidate();
b.TransformPoints(square);
}
}
}