using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace RectangleTest { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; Pen pen = new Pen(Color.Orange,3); g.DrawRectangle(pen,10,10,100,50); g.DrawLine(pen,new Point(10,70) ,new Point(110,70)); } } }