using System; using System.Windows.Forms; using System.Drawing; class TestForm : Form { protected override void OnPaint(PaintEventArgs ea) { base.OnPaint(ea); Graphics g = ea.Graphics; Point center = new Point(1 << 14, 1 << 14); int length = 100; Point topleft = new Point(center.X - length / 2, center.Y - length / 2); g.TranslateTransform(Width / 2 - center.X, Height / 2 - center.Y); g.DrawRectangle(new Pen(Color.Green), topleft.X, topleft.Y, length, length); g.DrawEllipse(new Pen(Color.Blue), topleft.X, topleft.Y, length, length); } protected override void OnResize(EventArgs ea) { base.OnResize(ea); Invalidate(); } public static void Main(string[] args) { Application.Run(new TestForm()); } }