This code sample will change the shape of the form into pentagon. To run the code, paste the code in the forms' paint event.
System.Drawing.Drawing2D.GraphicsPath requiredShape = new System.Drawing.Drawing2D.GraphicsPath(); Point[] Pentagon = new Point[6]; Pentagon[0] = new Point(100, 100); Pentagon[1] = new Point(300, 100); Pentagon[2] = new Point(500, 300); Pentagon[3] = new Point(300, 400); Pentagon[4] = new Point(100, 400); Pentagon[5] = new Point(100, 100);
requiredShape.AddPolygon(Pentagon); this.Region = new System.Drawing.Region(requiredShape); this.Invalidate();
|
No responses found. Be the first to respond and make money from revenue sharing program.
|