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 GraphicsAnimationTest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.Paint += Form1_Paint;
timer1.Start();
}
Rectangle rect = new Rectangle(50, 50, 50, 50);
int angle = 0;
private void Form1_Paint(object sender, PaintEventArgs e)
{
using (e.Graphics)
{
e.Graphics.CompositingQuality = CompositingQuality.HighQuality;
e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
angle += 5;
using (Matrix m = new Matrix())
{
m.RotateAt(angle, new Point(75, 75));
//m.Translate(1, 0, MatrixOrder.Append);
e.Graphics.Transform = m;
}
e.Graphics.DrawRectangle(new Pen(Brushes.Red, 2), rect);
}
}
private void timer1_Tick(object sender, EventArgs e)
{
this.Invalidate();
}
}
}
Graphics.Transform结合Matrix绘制仿射变换的动态图形
最新推荐文章于 2023-03-15 16:35:51 发布