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;
namespace irregular
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
timer1.Start();
}
private float f=0f;
private void Form1_Paint(object sender, PaintEventArgs e)
{
GraphicsPath gp = new GraphicsPath();
gp.AddEllipse(20, 20, 110, 110);
Rectangle a = new Rectangle(110, 110, 220, 220);
gp.AddRectangle(a);
Matrix rotation = new Matrix(1, 0, 0, 1, 1, 1);
PointF rotationpoint = new PointF(110f, 110f);
rotation.RotateAt(f, rotationpoint);
gp.Transform(rotation);
e.Graphics.DrawPath(Pens.Red, gp);
f += 1;
this.Region = new Region(gp);
}
private void timer1_Tick(object sender, EventArgs e)
{
this.Refresh();
}
}
}
No comments:
Post a Comment