Methods

Home | What's New! | Documentation | FAQ | Download | Forum | Example

Table of Contents

Circle_, Cls, GetWord, GTPaintPicture, Line_, PaintPicture, Point, Print_, PSet_, Refresh, Scale_, ScaleX, ScaleY, Size, TextHeight, TextWidth


Circle_


Description

Draws a circle, ellipse, or arc on an object.

Syntax

object.Circle_ x, y, radius, [color], [start], [end], [aspect]

Part Description
object an object expression that evaluates to a gtimage control.
x, y Single values indicating the coordinates for the center point of the circle,
ellipse, or arc. The ScaleMode property of object determines the units of
measure used.
radius Single value indicating the radius of the circle, ellipse, or arc.
The ScaleMode property of object determines the unit of measure used.
color Long integer value indicating the RGB color of the circle's outline.
If omitted, the value of the ForeColor property is used.
start, end Single-precision values. When an arc or a partial circle or ellipse is drawn,
start and end specify (in radians) the beginning and end positions of the arc.
The range for both is -2 pi radians to 2 pi radians. The default value for
start is 0 radians; the default for end is 2 * pi radians.
aspect Single-precision value indicating the aspect ratio of the circle. The default
value is 1.0, which yields a perfect (non-elliptical) circle on any screen.

Remarks

The underscore in Circle_ was required because Circle is a reserved word in VBA.

To fill a circle, set the FillColor and FillStyle properties of the object on which the circle or ellipse is drawn. Only a closed figure can be filled. Closed figures include circles, ellipses, or pie slices (arcs with radius lines drawn at both ends).

When drawing a partial circle or ellipse, if start is negative, Circle draws a radius to start, and treats the angle as positive; if end is negative, Circle draws a radius to end and treats the angle as positive. The Circle method always draws in a counter-clockwise (positive) direction.

The width of the line used to draw the circle, ellipse, or arc depends on the setting of the DrawWidth property. The way the circle is drawn on the background depends on the setting of the DrawMode and DrawStyle properties.

When drawing pie slices, to draw a radius to angle 0 (giving a horizontal line segment to the right), specify a very small negative value for start, rather than zero.

You can omit an argument in the middle of the syntax, but you must include the argument's comma before including the next argument. If you omit an optional argument, omit the comma following the last argument you specify.

When Circle executes, the CurrentX and CurrentY properties are set to the center point specified by the arguments.

Back to top


Cls


Description

Clears graphics and text generated at run time.

Syntax

object.Cls

Part Description
object an object expression that evaluates to a gtimage control.

Remarks

Cls clears text and graphics generated at run time by graphics statements. Background bitmaps set using the Picture property aren't affected by Cls. Graphics and text placed on an object while the AutoRedraw property is set to True aren't affected if AutoRedraw is set to False before Cls is invoked. That is, you can maintain text and graphics on an object by manipulating the AutoRedraw property of the object you're working with.

After Cls is invoked, the CurrentX and CurrentY properties of object are reset to 0.

Back to top


GetWord


Description

Returns the n'th word in a string.

Syntax

object.GetWord string, n

Part Description
object an object expression that evaluates to a gtimage control.
string String value containing the word to be extracted.
n Integer value specifying the word to be extracted.

Return Value

Returns a string value containing the n'th word in string.

Remarks

This was an internal routine I needed, and I thought it was handy enough to expose.

n is base 1, so:

word2 = mygtimage.GetWord("GT Image Control", 2)

Returns "Image".

Back to top


GTPaintPicture


Description

Draws the contents of a graphics file.

Syntax

object.GTPaintPicture URL, X1, Y1, [Width1], [Height1], [X2], [Y2], [Width2], [Height2], [Opcode]

Part Description
object an object expression that evaluates to a gtimage control.
URL A string value that specifies the file or URL of the graphic.
X1, Y1 Single-precision values indicating the destination coordinates
(x-axis and y-axis) on object for picture to be drawn.
Width1 Single-precision value indicating the destination width of picture.
If the destination width is larger or smaller than the source
width (width2), picture is stretched or compressed to fit. If omitted,
the source width is used.
Height1 Single-precision value indicating the destination height of picture.
If the destination height is larger or smaller than the source
height (height2), picture is stretched or compressed to fit. If omitted,
the source height is used.
X2, Y2 Single-precision values indicating the coordinates (x-axis and y-axis)
of a clipping region within picture. If omitted, 0 is assumed.
Width2 Single-precision value indicating the source width of a clipping region
within picture. If omitted, the entire source width is used.
Height2 Single-precision value indicating the source height of a clipping region
within picture. If omitted, the entire source height is used.
Opcode Long value or code that is used only with bitmaps. It defines a bit-wise
operation (for example, Not or Xor operator) that is performed on picture
as it's drawn on object.

Settings

See PaintPicture.

Remarks

All single-precision values are specified in pixels.
See PaintPicture.

Back to top


Line_


Description

Draws lines and rectangles on an object.

Syntax

object.Line_ X1, Y1, X2, Y2, [Color], [Options]

Part Description
object an object expression that evaluates to a gtimage control.
X1, Y1 Single values indicating the coordinates of the starting point for the
line or rectangle. The ScaleMode property determines the unit of
measure used.
X2, Y2 Single values indicating the coordinates of the end point for the line
being drawn.
Color Long integer value indicating the RGB color used to draw the line.
If omitted, the ForeColor property setting is used.
Options String value specifying the B and F options. A B included, causes a
box to be drawn using the coordinates to specify opposite corners of
the box.
If the B option is used, the F option specifies that the box is filled with
the same color used to draw the box. You cannot use F without B. If B
is used without F, the box is filled with the current FillColor and FillStyle.
The default value for FillStyle is transparent.

Remarks

To draw connected lines, begin a subsequent line at the end point of the previous line.

The width of the line drawn depends on the setting of the DrawWidth property. The way a line or box is drawn on the background depends on the setting of the DrawMode and DrawStyle properties.

When Line executes, the CurrentX and CurrentY properties are set to the end point specified by the arguments.

Back to top


PaintPicture


Description

Draws the contents of a graphics file.

Syntax

object.PaintPicture StdPicture, [X1], [Y1], [Width1], [Height1], [X2], [Y2], [Width2], [Height2], [Opcode]

Part Description
object an object expression that evaluates to a gtimage control.
StdPicture A long value that specifies the handle of the graphic.
X1, Y1 Single-precision values indicating the destination coordinates
(x-axis and y-axis) on object for picture to be drawn. The
ScaleMode property of object determines the unit of measure used.
Width1 Single-precision value indicating the destination width of picture.
The ScaleMode property of object determines the unit of measure
used. If the destination width is larger or smaller than the source
width (width2), picture is stretched or compressed to fit. If omitted,
the source width is used.
Height1 Single-precision value indicating the destination height of picture.
The ScaleMode property of object determines the unit of measure
used. If the destination height is larger or smaller than the source
height (height2), picture is stretched or compressed to fit. If omitted,
the source height is used.
X2, Y2 Single-precision values indicating the coordinates (x-axis and y-axis)
of a clipping region within picture. The ScaleMode property of object
determines the unit of measure used. If omitted, 0 is assumed.
Width2 Single-precision value indicating the source width of a clipping region
within picture. The ScaleMode property of object determines the unit
of measure used. If omitted, the entire source width is used.
Height2 Single-precision value indicating the source height of a clipping region
within picture. The ScaleMode property of object determines the unit
of measure used. If omitted, the entire source height is used.
Opcode Long value or code that is used only with bitmaps. It defines a bit-wise
operation (for example, Not or Xor operator) that is performed on picture
as it's drawn on object.

Settings

The settings for Opcode are:

Raster Op Value Description
DstInvert &H00550009 Inverts the destination bitmap
MergeCopy &H00C000CA Combines the pattern and the source bitmap
MergePaint &H00BB0226 Combines the inverted source bitmap with the destination bitmap by using Or
NotSrcCopy &H00330008 Copies the inverted source bitmap to the destination
NotSrcErase &H001100A6 Inverts the result of combining the destination and source bitmaps by using Or
PatCopy &H00F00021L Copies the pattern to the destination bitmap
PatInvert &H005A0049L Combines the destination bitmap with the pattern by using Xor
PatPaint &H00FB0A09L Combines the inverted source bitmap with the pattern by using Or. Combines the result of this operation with the destination bitmap by using Or
SrcAnd &H008800C6 Combines pixels of the destination and source bitmaps by using And
SrcCopy &H00CC0020 Copies the source bitmap to the destination bitmap
SrcErase &H00440328 Inverts the destination bitmap and combines the result with the source bitmap by using And
SrcInvert &H00660046 Combines pixels of the destination and source bitmaps by using Xor
SrcPaint &H00EE0086 Combines pixels of the destination and source bitmaps by using Or

Remarks

You can flip a bitmap horizontally or vertically by using negative values for the destination height (height1) and/or the destination width (width1).

You can omit as many optional trailing arguments as you want. If you omit an optional trailing argument or arguments, don't use any commas following the last argument you specify. If you want to specify an optional argument, you must specify all optional arguments that appear in the syntax before it.

Back to top


Point


Description

Returns, as an integer of type Long, the RGB color of the specified point on an object.

Syntax

object.Point x, y

Part Description
object an object expression that evaluates to a gtimage control.
x, y Single-precision values indicating the horizontal (x-axis)
and vertical (y-axis) coordinates of the point in the
ScaleMode property of the Form or PictureBox.
Parentheses must enclose the values.

Return Value

Returns a long value that specifies the color of a point.

Remarks

If the point referred to by the x and y coordinates is outside object, the Point method returns -1.

Back to top


Print_


Description

Prints text in the window of an object.

Syntax

object.Print_ OutputText

Part Description
object an object expression that evaluates to a gtimage control.
OutputText String value to be printed. Output occurs at the coordinates defined
by CurrentX and CurrentY

Remarks

All data printed to the window is properly formatted using the decimal separator for the locale settings specified for your system.

For Boolean data, either True or False is printed. The True and False keywords are translated according to the locale setting for the host application.

Date data is written using the standard short date format recognized by your system. When either the date or the time component is missing or zero, only the data provided is written.

Nothing is written if outputlist data is Empty. However, if outputlist data is Null, Null is output. The Null keyword is appropriately translated when it is output.

For error data, the output is written as Error errorcode. The Error keyword is appropriately translated when it is output.

Note Because the Print_ method typically prints with proportionally-spaced characters, there is no correlation between the number of characters printed and the number of fixed-width columns those characters occupy. For example, a wide letter, such as a "W", occupies more than one fixed-width column, and a narrow letter, such as an "i", occupies less. To allow for cases where wider than average characters are used, your tabular columns must be positioned far enough apart. Alternatively, you can print using a fixed-pitch font (such as Courier) to ensure that each character uses only one column.

Back to top


PSet_


Description

Sets a point on an object to a specified color.

Syntax

object.PSet_ x, y, [color]

Part Description
object an object expression that evaluates to a gtimage control.
x, y Single values indicating the horizontal (x-axis) and vertical
(y-axis) coordinates of the point to set.
Color Long integer value indicating the RGB color specified for
point. If omitted, the current ForeColor property setting is
used.

Remarks

The underscore in PSet_ was required because PSet is a reserved word in VBA.

The size of the point drawn depends on the setting of the DrawWidth property. When DrawWidth is 1, PSet sets a single pixel to the specified color. When DrawWidth is greater than 1, the point is centered on the specified coordinates.

The way the point is drawn depends on the setting of the DrawMode and DrawStyle properties.

When PSet_ executes, the CurrentX and CurrentY properties are set to the point specified by the arguments.

To clear a single pixel with the PSet_ method, specify the coordinates of the pixel and use the BackColor property setting as the color argument.

Back to top


Refresh


Description

Forces a complete repaint of an object.

Syntax

object.Refresh

Part Description
object an object expression that evaluates to a gtimage control.

Remarks

Use the Refresh method when you want to update the contents of the control.

Generally, painting a control is handled automatically while no events are occurring. However, there may be situations where you want the control updated immediately.

Back to top


Scale_


Description

Defines the coordinate system for an object.

Syntax

object.Scale [X1], [Y1], [X2], [Y2]

Part Description
object an object expression that evaluates to a gtimage control.
X1, Y1 Single-precision values indicating the horizontal (x-axis) and vertical
(y-axis) coordinates that define the upper-left corner of object.
Parentheses must enclose the values. If omitted, the second set of
coordinates must also be omitted.
X2, Y2 Single-precision values indicating the horizontal and vertical coordinates
that define the lower-right corner of object. Parentheses must enclose
the values. If omitted, the first set of coordinates must also be omitted.

Remarks

The Scale method enables you to reset the coordinate system to any scale you choose. Scale affects the coordinate system for both run-time graphics statements and the placement of controls.

If you use Scale with no arguments (both sets of coordinates omitted), it resets the coordinate system to twips.

Back to top


ScaleX


Description

Converts the value for the width of an object from one unit of measure to another.

Syntax

object.ScaleX width, fromscale, toscale

Part Description
object an object expression that evaluates to a gtimage control.
width Specifies, for object, the number of units of measure to be converted.
fromscale A constant or value specifying the coordinate system from which
width or height of object is to be converted, as described in Settings.
The possible values of fromscale are the same as for the ScaleMode
property, plus the new value of HiMetric.
toscale A constant or value specifying the coordinate system to which width
or height of object is to be converted, as described in Settings. The
possible values of toscale are the same as for the ScaleMode
property, plus the new value of HiMetric.

Return Value

Returns a single value that contains the converted width.

Settings

See ScaleY.

Remarks

See ScaleY.

Back to top


ScaleY


Description

Converts the value for the height of a Form, PictureBox, or Printer from one unit of measure to another.

Syntax

object.ScaleY height, fromscale, toscale

Part Description
object an object expression that evaluates to a gtimage control.
height Specifies, for object, the number of units of measure to be converted.
fromscale A constant or value specifying the coordinate system from which
width or height of object is to be converted, as described in Settings.
The possible values of fromscale are the same as for the ScaleMode
property, plus the new value of HiMetric.
toscale A constant or value specifying the coordinate system to which width
or height of object is to be converted, as described in Settings. The
possible values of toscale are the same as for the ScaleMode
property, plus the new value of HiMetric.

Return Value

Returns a single value that contains the converted height.

Settings

The settings for fromscale and toscale are:

Value Description
0 User-defined: indicates that the width or height of object is set to a custom value.
1 Twip (1440 twips per logical inch; 567 twips per logical centimeter).
2 Point (72 points per logical inch).
3 Pixel (smallest unit of monitor or printer resolution).
4 Character (horizontal = 120 twips per unit; vertical = 240 twips per unit).
5 Inch
6 Millimeter
7 Centimeter
8 HiMetric. If fromscale is omitted, HiMetric is assumed as the default.

Remarks

The ScaleX and ScaleY methods take a value (width or height), with its unit of measure specified by fromscale, and convert it to the corresponding value for the unit of measure specified by toscale.

You can also use ScaleX and ScaleY with the PaintPicture method.

Back to top


Size


Description

Changes the width and height of an object.

Syntax

object.Size width, height

Part Description
object an object expression that evaluates to a gtimage control.
width The width in twips of the object.
height The height in twips of the object.

Remarks

The Width and Height properties of an object are always given in Twips, regardless of ScaleMode.

Back to top


TextHeight


Description

Returns the height of a text string as it would be printed in the current font.

Syntax

 

object.TextHeight String

Part Description
object an object expression that evaluates to a gtimage control.
String A string expression that evaluates to a string for which
the text height is determined. Parentheses must enclose
the string expression.

Return Value

Returns a single value that specifies the height of the text.

Remarks

The height is expressed in terms of the ScaleMode property setting or Scale method coordinate system in effect for object. Use TextHeight to determine the amount of vertical space required to display the text. The height returned includes the normal leading space above and below the text, so you can use the height to calculate and position multiple lines of text within object.

If string contains embedded carriage returns, TextHeight returns the cumulative height of the lines, including the leading space above and below each line.

Back to top


TextWidth


Description

Returns the width of a text string as it would be printed in the current font.

Syntax

object.TextWidth String

Part Description
object an object expression that evaluates to a gtimage control.
String A string expression that evaluates to a string for which
the text width is determined. Parentheses must enclose
the string expression.

Return Value

Returns a single value that specifies the width of the text.

Remarks

The width is expressed in terms of the ScaleMode property setting or Scale method coordinate system in effect for object. Use TextWidth to determine the amount of horizontal space required to display the text. If string contains embedded carriage returns, TextWidth returns the width of the longest line.

Back to top

Home | What's New! | Documentation | FAQ | Download | Forum | Example

Copyright © 1997 by Graphic Traffic. All rights reserved.
Last updated Tuesday, April 22, 2003
webmaster@graffic.com