Drawing Points

This topic provides examples that demonstrate how to draw a single pixel and how to draw a point with a pen three-pixels wide.

Drawing a single pixel

Use Plot() to draw a single point in the center of the screen.

...
TPoint screenCenterPoint=rect.Center(); // the center of the screen
...
    
// draw a single pixel point in the center of the screen
gc.Plot(screenCenterPoint);
...

Drawing a point three pixels wide

  1. Define a size for the pen tip as a TSize.

  2. Use SetPenSize() to increase the pen width from the default (single pixel). This shows how a plotted point three pixels wide is much easier to see than a single pixel. It is in fact drawn as a "+" shape.

  3. Use Plot() to draw a point in the center of the screen.

...
TPoint screenCenterPoint=rect.Center(); // the center of the screen
...
    
// Set up a "bold" size for the pen tip to (default is 1,1)
TSize penSizeBold(3,3);
...
    
// draw a "bold" point 3 pixels across
gc.SetPenSize(penSizeBold);
gc.Plot(screenCenterPoint);
...

Related concepts