Using Pens

From RAD Studio
Jump to: navigation, search

Go Up to Using the Properties of the Canvas Object


The Pen property of a canvas controls the way lines appear, including lines drawn as the outlines of shapes. Drawing a straight line is really just changing a group of pixels that lie between two points.

The pen itself has four properties you can change:

  • The Color property changes the pen color.
  • The Width property changes the pen width.
  • The Style property changes the pen style.
  • The Mode property changes the pen mode.

The values of these properties determine how the pen changes the pixels in the line. By default, every pen starts out black, with a width of 1 pixel, a solid style, and a mode called copy that overwrites anything already on the canvas.

You can use Vcl.Graphics.TPenRecall for quick saving off and restoring the properties of pens.

See Also