Click to Rate and Give Feedback

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
Windows Forms Programming 
How to: Set the Color of a Pen 

This example changes the color of a pre-existing Pen object

Example

Visual Basic
myPen.Color = System.Drawing.Color.PeachPuff
C#
myPen.Color = System.Drawing.Color.PeachPuff;
C++
myPen->Color = System::Drawing::Color::PeachPuff;

Compiling the Code

This example requires:

  • A Pen object named myPen.

Robust Programming

You should call Dispose on objects that consume system resources (such as Pen objects) after you are finished using them.

See Also

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker