Draws a picture control at a specified location in the current window.
Picture controls
picture.Draw ( xlocation, ylocation )
Argument |
Description |
---|---|
picture |
The name of the picture control you want to draw in the current window |
xlocation |
The x coordinate of the location (in PowerBuilder units) at which you want to draw the picture |
ylocation |
The y coordinate of the location (in PowerBuilder units) at which you want to draw the picture |
Integer. Returns 1 if it succeeds and -1 if an error occurs. If any argument’s value is null, Draw returns null. The return value is usually not used.
Using the Draw function is faster and produces less flicker than successively changing the X property of a picture. This is because the Draw function draws directly on the window rather than recreating a small window with the picture in it for each change. Therefore, use Draw to draw pictures in animation.
To create animation, you can place a picture outside the visible portion of the window and then use the Draw function to draw it at different locations in the window. However, the image remains at all the positions where you draw it. If you change the position by small increments, each new drawing of the picture covers up most of the previous image.
Using Draw does not change the position of the picture control—it just displays the control’s image at the specified location. Use the Move function to actually change the position of the control.
This statement draws the bitmap p_Train at the location specified by the X and Y coordinates 100 and 200:
p_Train.Draw(100, 200)
These statements draw the bitmap p_ Train in many different locations so it appears to move from left to right across the window:
integer horizontal
FOR horizontal = 1 TO 2000 STEP 8
p_Train.Draw(horizontal, 100)
NEXT