private void DrawPen() { //Graphics g = CreateGraphics(); Graphics g = ActiveForm.CreateGraphics(); Pen p = new Pen(Color.Red, 10); // Draw a line: g.DrawLine(p, 1, 1, 100, 100); // Draw a Pie: g.DrawPie(p, 200, 20, 100, 100, -30, 60); // Draw a polygon Point[] points = new Point[] { new Point(5, 5), new Point(50, 10), new Point(60, 20), new Point(100, 70), new Point(200, 100) }; g.DrawPolygon(p, points); // Set pen style p.DashStyle = DashStyle.Dash; p.Color = Color.BlueViolet; g.DrawLine(p, 100, 100, 200, 200); // Set start/end cap p.StartCap = LineCap.ArrowAnchor; p.EndCap = LineCap.Triangle; p.Color = Color.ForestGreen; g.DrawLine(p, 200, 200, 300, 300); }
private void DrawBrush() { Graphics g = ActiveForm.CreateGraphics(); SolidBrush solidBrush = new SolidBrush(Color.Red); Point[] points = new Point[] { new Point(50, 50), new Point(100, 125), new Point(50, 200), new Point(75, 250), new Point(200, 150) }; // Solid brush g.FillPolygon(solidBrush, points); Brush linearBrush = new LinearGradientBrush(new Point(160, 160), new Point(200, 600), Color.Red, Color.Gray); Point[] points1 = new Point[] { new Point(160, 160), new Point(240, 350), new Point(370, 500), new Point(270, 550), new Point(200, 600) }; // linear brush g.FillPolygon(linearBrush, points1); }
private void DrawIcon() { Graphics g = ActiveForm.CreateGraphics(); g.DrawIcon(SystemIcons.Information, 40, 40); }