User-Drawn Controls in DataWindow Objects – PB Docs 150

User-Drawn Controls in DataWindow Objects

The Paint expression functions allow you to draw objects in the DataWindow such as polygons, arrow tips, pie slices, and so on.

The Paint expression function takes one string expression argument and returns the same string. This allows you to paint inside a DataWindow in a way that respects the position and z-order of other DataWindow objects.


Paint(expr) where expr can be any valid DataWindow expression. It should contain a function call to a drawing global function with rendering logic. If expr is a string expression and the value is not null, the Computed Field will render the evaluated string expression.

This feature also provides the following supporting functions:

  • GetPaintDC()
  • GetPaintRectX()
  • GetPaintRectY()
  • GetPaintRectWidth()
  • GetPaintRectHeight()

GetPaintDC() returns the GDI context to which to draw. The clip region of the GDI context is guaranteed to be the same as the rectangle defined by the other functions.

GetPaintRectX(), GetPaintRectY(), GetPaintRectWidth(), and GetPaintRectWidth() return the bounds of the computed field. The device context is clipped within these bounds.

Example 1

This example instantiates the drawing functions and, if the drawing function returns false, the text “Bail out” displays.

Parent topic: PowerBuilder Classic

Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x