Skip to content

Instantly share code, notes, and snippets.

@audinue
Created July 2, 2017 09:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save audinue/eb51c9c9f88103c53aeb29a6c6d7d403 to your computer and use it in GitHub Desktop.
Save audinue/eb51c9c9f88103c53aeb29a6c6d7d403 to your computer and use it in GitHub Desktop.
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
a += 1f;
var g = e.Graphics;
var gp = new GraphicsPath();
gp.AddRectangle(new RectangleF(0, 0, 100, 100));
var m = new Matrix();
m.Translate(100, 100);
m.Translate(50, 50);
m.Rotate(a);
m.Scale(.5f, .5f);
gp.Transform(m);
g.FillRectangle(Brushes.Red, gp.GetBounds());
g.DrawPath(Pens.Black, gp);
g.DrawRectangle(Pens.Blue, 100, 100, 100, 100);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment