Pen myPen = new Pen(Color.Red, 3); Pen newPen = (Pen)myPen.Clone();
Graphics graphics = this.CreateGraphics(); Pen myPen = new Pen(Color.Blue, 2); graphics.DrawLine(myPen, new Point(10, 10), new Point(100, 100)); Pen newPen = (Pen)myPen.Clone(); newPen.Color = Color.Green; graphics.DrawLine(newPen, new Point(10, 100), new Point(100, 10));In this example, a new Pen object is created with a blue color and a thickness of 2. The DrawLine method is then called to draw a line using the original Pen object. The Clone method is called to create a copy of the original Pen object and assign it to the newPen variable. The color of the new Pen object is then changed to green, and another line is drawn using the new Pen object. The System.Drawing namespace is where the Pen class and the Clone method are located.