Home > Language Reference > Classes
Display Class
+ Object
+ Display
Description
The Display class implements all the methods for drawing onscreen or offscreen. The Bitmap and Form classes as well as all controls derive directly or indirectly from Display. This class is not instantiable, derivable nor cloneable. The functionality it defines is only usable through its subclasses.
Each Display object encapsulates state information necessary for carrying out graphics operations. This information includes the following properties:
The first three items are not accessible directly, and are implicitly determined by the object on which you are drawing. For example, a control automatically defines its coordinates origin as being the top left corner of the control, and the clipping area as corresponding to the size of the control. In addition, the axes are always directed towards the bottom and the right.
The last four items on the other hand must be set by the programmer using the CoordinateSystem, BackColor, ForeColor, TextColor, Pattern, DrawFont and ScaleFont properties. All these items are specific to each Display object. For example, if you modify the foreground color of a control, you will not change the foreground color of the form on which it is placed.
Graphics operations themselves are carried out using the drawing methods such as Rectangle or PutPixel. Most of these methods use state information described above. Refer to the information at the bottom of the page for an exhaustive list of graphics methods available.
Drawing operations are very costly in terms of performance. A part of this overhead is caused by the necessary graphic context switching before every operation. Therefore, for performance reasons, graphics methods are not executed directly but cached into a buffer. When the buffer is full, or you make an explicit call to the Flush method, all the graphics instructions are carried out quickly in one go. The BatchLimit modifies the size of this buffer which by default is 8. If your program uses graphics functions intensively, it is highly recommended to increase this value.
Note however that only the Form and Bitmap objects have a graphic instructions buffer. Controls always use the instruction buffer of the form on which they are placed. Thus, modifing the size or emptying the buffer of a control is actually carried out on the buffer of the parent form.
Finally, it is possible to efficiently copy a rectangular area of a Display object to another using the CopyArea method. This is typically used to display a bitmap on screen or to save the screen in a bitmap.
The Autograph and Pattern samples contain several examples that use the Display properties and methods.
Note: if you plan to use the high-density feature, it is strongly advised to read the Graphics section of this documentation to learn more about coordinates system, and bitmap and screen densities.
Members
| Members | Description |
| Arc | Draws an arc. |
| BackColor | Background color. |
| BatchLimit | Size of the graphics instruction buffer. |
| CoordinateSystem | Coordinates system. |
| CopyArea | Efficiently copies part of a Display object to another. |
| DrawFont | Font used to draw the text. |
| Flush | Empties the graphics instruction buffer. |
| FontMetrics | Returns a FontMetrics object describing the physical charateristics of the currently active font. |
| ForeColor | Foreground color. |
| GetPixel | Queries the color of a given pixel. |
| hWin | Returns the window handle. |
| Line | Draws a line. |
| Oval | Draws a circle or ellipse. |
| Pattern | Defines the pattern used to fill drawings. |
| Polygon | Draws a polygon. |
| PutPixel | Sets the color of a pixel. |
| Rectangle | Draw a rectangle. |
| ResID | Identifier of the resource associated with the object. |
| ScaleFont | Enable or disable font scaling. |
| TextColor | Text color. |
| TextOut | Draw text. |
| Inherited from Object | Description |
| ClassID | Returns the type identifier corresponding to the actual class of the object. |
| Implements | Determines whether the object implements the features of a given class. |
| Iterate | Event raised to iterate over the elements of a container object. |
| Recipient | Recipient of events sent by the object. |
| Serialize | Event raised to serialize the object content into a stream. |
System requirements
| System | Minimal version | Remarks |
| Palm OS | Palm OS 3.0 | N/A |