PictureBox                                                                 Object

ADDOBJECT "PictureBox"[, name[, xpos[, ypos

                [, width[, height]]]]]

Description

PictureBox is used to display text and graphics in objects that float over the output window. The optional component, name, is the name of a variable that is added to the program to reference the object, it must follow standard variable naming conventions. The optional components, xpos, ypos, width, and height are numeric expressions that set the location and size of the object in pixels, measured from the upper left corner. The output window itself is a PictureBox, the program variable Output can be used with PictureBox properties, methods, and events.

Properties Supported (see "Properties")

BackColor, BorderStyle. FontBold, FontItalic, FontName, FontSize, FontStrikethru, FontUnderline, ForeColor, Height, Left, Name, Tag, Text, Top, Width

Table 17: PictureBox Properties

Name

Description

DrawWidth

Line width for draw methods

FillColor

Color, used to fill shapes, circles or boxes.

FillStyle

0 solid, 1 transparent

FontTransparent

True/False

Picture

String with name of an image file.

ScaleHeight

Units for height using custom scale

ScaleLeft

Left edge of object, to scale

ScaleMode

0 user defined

1 Twips (1440 dpi)

2 Points (72 dpi)

3 Pixels

4 Characters (horizontal = 120 twips, vertical = 240 twips)

5 inches

6 millimeters

7 centimeters

ScaleTop

Top of current object

ScaleWidth

Units for width using custom scale

Tag

Use for anything

 

Methods Supported (see "Methods")

Move

Table 18: PictureBox Methods

Name

Arguments

Description

Cls

 

Clears text and graphics, but not print.

DrawCircle

x, y, radius[, color [, aspectRatio]]

Draw a circle or ellipse.

DrawLine

x1, y1, x2, y2[, color [, box [, fill]]]

box is TRUE/FALSE

DrawPicture

filename, x1, y1[, width, height, x2, y2, width2, height2], rasterop]

Draw part or all of an image file on the object (can also rescale).

DrawPoint

x, y[, color]

Draw a single point.

DrawText

Text[,x,y]

Draws on next line on object., or at x,y if specified.

Refresh

 

Redraw the object.

ScaleX

width, from, to

Converts scale of width.

ScaleY

height, from, to

Converts scale of height.

SetScale

x1, y1, x2, y2

Use to change scale.

TextHeight

text

Returns height of text., embedded CR's OK.

TextWidth

text

Returns width of widest line.

 

Events Supported (see "Events")

Click

Table 19: PictureBox Events

Name

Arguments

Description

KeyDown

keyCode+, shift*

Key is pressed.

KeyPress

keyCode+

Combination of KeyDown and KeyUp.

KeyUp

keyCode+, shift*

Key is released.

MouseDown#

button, shift*, x, y

Object is contacted with stylus or input device.

MouseMove#

button, shift*, x, y

Stylus or input device is moved while in contact with object.

MouseUp#

button, shift*, x, y

Stylus is lifted from object, or input device breaks contact with object.

+             Keyboard code of key that generated event.

*             1 = Shift key, 2 = CTRL key, 4 = ALT key

†             Only in Output PictureBox object. Global

                property KeyPreview must be TRUE to receive

                this event.

#             button is input device button used to contact

                object (0 = Stylus). x, y, show location of contact

                relative to object

Example

REM PictureBox Example

ADDOBJECT "PictureBox", "PBox", 65, 0, 55,20

PBox.BorderStyle = 1

PBox.BackColor = vbWHITE

PBox.DrawText " Button"

SUB PBox_Click

  PRINT Output.Width & " X " & Output.Height

END SUB

Output

(screen size is machine dependant)

Related Items

ADDOBJECT