Sandbox
From CometWiki
Line 23: | Line 23: | ||
- | MNEMONICS: | + | '''MNEMONICS:''' |
Commands are issued to a Windows printer using IB mnemonics. These commands can be issued directly in the form of a PRINT (list) statement or through a PRINT (format) statement. If the PRINT (list) method is used a (TR) mnemonic must precede all commands in the list. For example: | Commands are issued to a Windows printer using IB mnemonics. These commands can be issued directly in the form of a PRINT (list) statement or through a PRINT (format) statement. If the PRINT (list) method is used a (TR) mnemonic must precede all commands in the list. For example: | ||
Line 47: | Line 47: | ||
The following files are normally stored in the WDL directory. They are Hyperlinked here for ease of understanding. | The following files are normally stored in the WDL directory. They are Hyperlinked here for ease of understanding. | ||
- | + | ||
* COSUTLD.INC Constants and variables commonly used by other USE files and applications for parameter passing (TRUE, FALSE, NULL, etc). | * COSUTLD.INC Constants and variables commonly used by other USE files and applications for parameter passing (TRUE, FALSE, NULL, etc). | ||
Line 53: | Line 53: | ||
* LOGFNT.IBS Functions used to manipulate fonts | * LOGFNT.IBS Functions used to manipulate fonts | ||
* LOGFNT.INC Constants and variables used by #LOGFNT | * LOGFNT.INC Constants and variables used by #LOGFNT | ||
+ | * FILFND.IBS Contains routine for finding DOS filenames for files living in Comet directories | ||
+ | * FILFND.INC Constants and variables used by #FILFND | ||
+ | * DESERVE.INC Declaratives for Driver Event Server programs | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
Hyperlinks to detailed explanation of Enhanced Printing Functions | Hyperlinks to detailed explanation of Enhanced Printing Functions | ||
- | |||
'''(Draw Bitmap)''' | '''(Draw Bitmap)''' | ||
- | |||
Draws the bitmap contained in the file (.BMP/.JPG) specified in <FileName> in the rectangle specified by <Left>, <Top>, <Right>, <Bottom> using the format codes contained in <Flags>. Scaling factors can be specified in <ScaleX>, <ScaleY>. | Draws the bitmap contained in the file (.BMP/.JPG) specified in <FileName> in the rectangle specified by <Left>, <Top>, <Right>, <Bottom> using the format codes contained in <Flags>. Scaling factors can be specified in <ScaleX>, <ScaleY>. | ||
'''(DrawText)''' | '''(DrawText)''' | ||
- | |||
Prints the specified text <Printable Text> into the rectangle specified by the coordinates <Left>, <Top>, <Right>, <Bottom> using the format codes specified in <Flags>. | Prints the specified text <Printable Text> into the rectangle specified by the coordinates <Left>, <Top>, <Right>, <Bottom> using the format codes specified in <Flags>. | ||
- | + | ''' | |
- | (Ellipse) | + | (Ellipse)''' |
- | |||
Draws an ellipse bound by the rectangle specified by <Left>, <Top>, <Right>, <Bottom> using the currently selected pen and brush. | Draws an ellipse bound by the rectangle specified by <Left>, <Top>, <Right>, <Bottom> using the currently selected pen and brush. | ||
- | (GetBkColor) | + | '''(GetBkColor)''' |
Returns the current background color. | Returns the current background color. | ||
- | (GetBkMode) | + | '''(GetBkMode)''' |
Returns the current background mode. | Returns the current background mode. | ||
- | (GetFontInfo ) | + | '''(GetFontInfo''' ) |
Returns the font information specified by <ItemCode>. | Returns the font information specified by <ItemCode>. | ||
- | (GetFuncResult) | + | '''(GetFuncResult)''' |
Request the 4 byte result of the last printer function. | Request the 4 byte result of the last printer function. | ||
- | (GetPageInfo) | + | '''(GetPageInfo)''' |
Returns the information specified in <ItemCode> Exactly what information is entered in <ItemCode> and in what format is a mystery. | Returns the information specified in <ItemCode> Exactly what information is entered in <ItemCode> and in what format is a mystery. | ||
- | (GetROP2) | + | '''(GetROP2)''' |
Returns the current foreground mix mode. | Returns the current foreground mix mode. | ||
- | (GetTextAlign) | + | '''(GetTextAlign)''' |
Returns the current text alignment mode. | Returns the current text alignment mode. | ||
- | (GetTextColor) | + | '''(GetTextColor)''' |
Returns the current text color. | Returns the current text color. | ||
- | (GetTextExtent) | + | '''(GetTextExtent)''' |
Measures the size (width and height) of the specified <Printable Text>. | Measures the size (width and height) of the specified <Printable Text>. | ||
- | + | '''(LineTo)''' | |
- | (LineTo) | + | |
Draws a line using the currently selected pen from the current location pointer to the location specified by <X, Y>. | Draws a line using the currently selected pen from the current location pointer to the location specified by <X, Y>. | ||
- | (MoveTo) | + | '''(MoveTo)''' |
Moves the current location pointer to the location specified by <X> and <Y>. | Moves the current location pointer to the location specified by <X> and <Y>. | ||
- | (Rectangle) | + | '''(Rectangle)''' |
Draws a the rectangle specified by <Left>, <Top>, <Right>, <Bottom> using the currently selected pen and brush. | Draws a the rectangle specified by <Left>, <Top>, <Right>, <Bottom> using the currently selected pen and brush. | ||
- | (RoundRect) | + | '''(RoundRect)''' |
Draws a rectangle with corners rounded using the ellipse specified by <CornerWidth> and <CornerHeight> at the location specified by <Left>, <Top>, <Right>, <Bottom> using the currently selected pen and brush. | Draws a rectangle with corners rounded using the ellipse specified by <CornerWidth> and <CornerHeight> at the location specified by <Left>, <Top>, <Right>, <Bottom> using the currently selected pen and brush. | ||
- | (SelectFont) | + | '''(SelectFont)''' |
Selects the font specified by the <LogFont> structure. | Selects the font specified by the <LogFont> structure. | ||
- | (SelectHatchBrush) | + | '''(SelectHatchBrush)''' |
Selects the hatched brush described <Style> and <Red>, <Green>, <Blue>. | Selects the hatched brush described <Style> and <Red>, <Green>, <Blue>. | ||
- | + | ''' | |
- | (SelectPen) | + | (SelectPen)''' |
Selects the pen described by <Style>, <Width> and <Red>, <Green>, <Blue>. | Selects the pen described by <Style>, <Width> and <Red>, <Green>, <Blue>. | ||
- | (SelectSolidBrush) | + | '''(SelectSolidBrush)''' |
Selects the solid brush described <Red>, <Green>, <Blue>. | Selects the solid brush described <Red>, <Green>, <Blue>. | ||
- | (SelectSysFont) | + | '''(SelectSysFont)''' |
Selects the SYSTEM font specified by <FontNumber>. | Selects the SYSTEM font specified by <FontNumber>. | ||
- | (SetBkColor) | + | '''(SetBkColor)''' |
Sets the current background color as specified by <Red>, <Green>, <Blue>. | Sets the current background color as specified by <Red>, <Green>, <Blue>. | ||
- | (SetBkMode ) | + | '''(SetBkMode )''' |
Sets the background mode specified by <Mode>. | Sets the background mode specified by <Mode>. | ||
- | (SetOrientation) | + | '''(SetOrientation)''' |
Sets the paper orientation contained in <Mode>. | Sets the paper orientation contained in <Mode>. | ||
- | (SetROP2 ) | + | '''(SetROP2 )''' |
Sets the current foreground mix mode. | Sets the current foreground mix mode. | ||
- | (SetTextAlign) | + | '''(SetTextAlign)''' |
Sets the text alignment mode to that specified by <Flags>. | Sets the text alignment mode to that specified by <Flags>. | ||
- | (SetTextColor) | + | '''(SetTextColor)''' |
Sets the current text color as specified by <Red>, <Green>, <Blue>. | Sets the current text color as specified by <Red>, <Green>, <Blue>. | ||
- | (TextOut) | + | '''(TextOut)''' |
Prints the specified <Printable Text> at the location specified by <X> and <Y>. | Prints the specified <Printable Text> at the location specified by <X> and <Y>. | ||
- | LineSpacing | + | '''LineSpacing''' |
Adjusts the line spacing for the current font to <LinesPerInch>. Due to differences in font design, when you select a font you may get the desired font but not the desired spacing (external leading may have been applied). This function provides a line spacing override that will adjust the font to fit your page requirements. | Adjusts the line spacing for the current font to <LinesPerInch>. Due to differences in font design, when you select a font you may get the desired font but not the desired spacing (external leading may have been applied). This function provides a line spacing override that will adjust the font to fit your page requirements. | ||
- | PopFont | + | '''PopFont''' |
Restores a font previously saved with a PushFont. (See PushFont). | Restores a font previously saved with a PushFont. (See PushFont). | ||
- | PushFont | + | '''PushFont''' |
Line 223: | Line 215: | ||
- | SelectFont | + | '''SelectFont''' |
(SelectFont);<LogFontData> | (SelectFont);<LogFontData> | ||
Line 232: | Line 224: | ||
Typically, a user will call GDI.InitLogFont first to set all font fields to their default values, and then modify whichever field needs changing. | Typically, a user will call GDI.InitLogFont first to set all font fields to their default values, and then modify whichever field needs changing. | ||
- | |||
Line 241: | Line 232: | ||
Some commonly modified fields are: | Some commonly modified fields are: | ||
- | lfHeight$ Font size in 10th's of a point (inch/72). The font | + | '''lfHeight$''' Font size in 10th's of a point (inch/72). The font mapper looks for the largest font that does not exceed the requested size; if there is no such font, it looks for the smallest font available. |
- | + | ||
- | mapper looks for the largest font that does not exceed | + | |
- | + | ||
- | the requested size; if there is no such font, it looks | + | |
- | + | ||
- | for the smallest font available. | + | |
- | lfWidth$ Specifies the average width, in logical units, of | + | '''lfWidth$''' Specifies the average width, in logical units, of characters in the font.(/lr) If lfWidth is zero, the aspect ratio of the device is matched against the digitization aspect ratio of the available fonts to find the closest match, determined by the absolute value of the difference. |
- | + | ||
- | characters in the font. If lfWidth is zero, the aspect | + | |
- | + | ||
- | ratio of the device is matched against the digitization | + | |
- | + | ||
- | aspect ratio of the available fonts to find the closest | + | |
- | + | ||
- | match, determined by the absolute value of the difference. | + | |
- | lfEscapement$ Specifies the angle, in tenths of degrees, of each line | + | '''lfEscapement$''' Specifies the angle, in tenths of degrees, of each line |
of text written in the font (relative to the bottom of the page). | of text written in the font (relative to the bottom of the page). |
Revision as of 01:26, 13 January 2010
C:\My Documents\ABS\EnhPrint.htm Enhanced Printing Reference
Introduction to concepts and terms
UNIT OF MEASURE - TWIPS:
Regardless of the nature of the printer being addressed, the pixel resolution used by the windows printer driver is in TWIPS. 1 TWIP is equal to 1/20th of a printer's POINT. 1 POINT is equal to 1/72nd of an inch. Therefore there are 1440 TWIPS per inch or 567 TWIPS per centimeter. Unless otherwise stated, ALL functions contained herein use TWIPS as the unit of measure.
PAGE SIZES:
When calculating the dimensions of a printer page, keep in mind that in many cases the entire page is not always printable (HP Laser printers have a 1/4" unprintable area on all four sides). Therefore, it may be necessary to inquire as to not just the page size, but also the offset from the physical page boundary to the printable page boundary. See GetPageInfo for additional info.
FONTS:
Font sizes are requested in tenth's of a point. This does not guarantee that the font created is exactly the requested size. It is important to inquire AFTER selecting a font as to the actual size the font mapper created. Also, when printing text there is usually some additional space (external leading) added between lines. This space is specified by the font designer and should be combined with the font height to determine the height of a line. See GetFontInfo for additional information.
MNEMONICS:
Commands are issued to a Windows printer using IB mnemonics. These commands can be issued directly in the form of a PRINT (list) statement or through a PRINT (format) statement. If the PRINT (list) method is used a (TR) mnemonic must precede all commands in the list. For example:
Using the PRINT (list) method PRINT (Lun) (TR);(Move To = X1, Y1);(Line To = X2, Y2)
Using a Format statement FmtLineAt: Format (Move To = X1, Y1) ;(Line To = X2, Y2) . . .
PRINT (Lun, FmtLineAt)
USE FILES:
The following files are normally stored in the WDL directory. They are Hyperlinked here for ease of understanding.
- COSUTLD.INC Constants and variables commonly used by other USE files and applications for parameter passing (TRUE, FALSE, NULL, etc).
- PTRCTLD.INC Printer driver function constants (paper sizes, bins, etc.)
- LOGFNT.IBS Functions used to manipulate fonts
- LOGFNT.INC Constants and variables used by #LOGFNT
- FILFND.IBS Contains routine for finding DOS filenames for files living in Comet directories
- FILFND.INC Constants and variables used by #FILFND
- DESERVE.INC Declaratives for Driver Event Server programs
Hyperlinks to detailed explanation of Enhanced Printing Functions
(Draw Bitmap)
Draws the bitmap contained in the file (.BMP/.JPG) specified in <FileName> in the rectangle specified by <Left>, <Top>, <Right>, <Bottom> using the format codes contained in <Flags>. Scaling factors can be specified in <ScaleX>, <ScaleY>.
(DrawText)
Prints the specified text <Printable Text> into the rectangle specified by the coordinates <Left>, <Top>, <Right>, <Bottom> using the format codes specified in <Flags>. (Ellipse)
Draws an ellipse bound by the rectangle specified by <Left>, <Top>, <Right>, <Bottom> using the currently selected pen and brush.
(GetBkColor)
Returns the current background color.
(GetBkMode)
Returns the current background mode.
(GetFontInfo )
Returns the font information specified by <ItemCode>.
(GetFuncResult)
Request the 4 byte result of the last printer function.
(GetPageInfo)
Returns the information specified in <ItemCode> Exactly what information is entered in <ItemCode> and in what format is a mystery.
(GetROP2)
Returns the current foreground mix mode.
(GetTextAlign)
Returns the current text alignment mode.
(GetTextColor)
Returns the current text color.
(GetTextExtent)
Measures the size (width and height) of the specified <Printable Text>.
(LineTo)
Draws a line using the currently selected pen from the current location pointer to the location specified by <X, Y>.
(MoveTo)
Moves the current location pointer to the location specified by <X> and <Y>.
(Rectangle)
Draws a the rectangle specified by <Left>, <Top>, <Right>, <Bottom> using the currently selected pen and brush.
(RoundRect)
Draws a rectangle with corners rounded using the ellipse specified by <CornerWidth> and <CornerHeight> at the location specified by <Left>, <Top>, <Right>, <Bottom> using the currently selected pen and brush.
(SelectFont)
Selects the font specified by the <LogFont> structure.
(SelectHatchBrush)
Selects the hatched brush described <Style> and <Red>, <Green>, <Blue>.
(SelectPen)
Selects the pen described by <Style>, <Width> and <Red>, <Green>, <Blue>.
(SelectSolidBrush)
Selects the solid brush described <Red>, <Green>, <Blue>.
(SelectSysFont)
Selects the SYSTEM font specified by <FontNumber>.
(SetBkColor)
Sets the current background color as specified by <Red>, <Green>, <Blue>.
(SetBkMode )
Sets the background mode specified by <Mode>.
(SetOrientation)
Sets the paper orientation contained in <Mode>.
(SetROP2 )
Sets the current foreground mix mode.
(SetTextAlign)
Sets the text alignment mode to that specified by <Flags>.
(SetTextColor)
Sets the current text color as specified by <Red>, <Green>, <Blue>.
(TextOut)
Prints the specified <Printable Text> at the location specified by <X> and <Y>.
LineSpacing
Adjusts the line spacing for the current font to <LinesPerInch>. Due to differences in font design, when you select a font you may get the desired font but not the desired spacing (external leading may have been applied). This function provides a line spacing override that will adjust the font to fit your page requirements.
PopFont
Restores a font previously saved with a PushFont. (See PushFont).
PushFont
Saves the current font on a stack so it can be restored with a corresponding PopFont. This feature allows a programmer to modify the printer font for a specific purpose and then restore the previous font without knowing how it was selected.
SelectFont
(SelectFont);<LogFontData>
Selects the font specified by the <LogFont> structure.
Typically, a user will call GDI.InitLogFont first to set all font fields to their default values, and then modify whichever field needs changing.
Because the font structure consists of MTB strings, the INTEL/INTELD functions must be used to effect any modifications. For an example see the GDI.InitLogFont function in the USE file #LOGFNT.
Some commonly modified fields are:
lfHeight$ Font size in 10th's of a point (inch/72). The font mapper looks for the largest font that does not exceed the requested size; if there is no such font, it looks for the smallest font available.
lfWidth$ Specifies the average width, in logical units, of characters in the font.(/lr) If lfWidth is zero, the aspect ratio of the device is matched against the digitization aspect ratio of the available fonts to find the closest match, determined by the absolute value of the difference.
lfEscapement$ Specifies the angle, in tenths of degrees, of each line
of text written in the font (relative to the bottom of the page).
lfWeight$ Darkness (or lightness) of the characters
lfItalic$ Specifies an italic font if set to TRUE.
lfUnderline$ Specifies an underlined font if set to TRUE.
lfStrikeOut$ Specifies a strikeout font if set to TRUE.
lfFaceName$ Desired font face ("Arial", "Courier New", etc.)
SelectSysFont
(SelectSysFont = <FontNumber>)
Selects the SYSTEM font specified by <FontNumber>.
Where:
<FontNumber> A Number from 0 to 2, corresponding to an entry
in the COSW.INI [Printer Fonts] section.
Provides a system dependent method for assuring compatible printer output
by allowing the user to choose the system fonts according to what is available on her system.
Font numbers are defined as follows:
0 Used for normal printing
1 Used for compact (compressed) printing
2 Used for wide (expanded) printing
<Back to Top>
GetFontInfo
(GetFontInfo = <ItemCode>)
Returns the font information specified by <ItemCode>.
Where <ItemCode> is:
PTR.FONT.HEIGHT - Specifies the height (ascent + descent) of characters
PTR.FONT.EXTLEADING - Specifies the amount of extra leading (space) that
the application adds between rows. Since this area
is outside the font, it contains no marks and is
not altered by text output calls in either OPAQUE
or TRANSPARENT mode. May be 0.
PTR.FONT.AVECHARWIDTH - Specifies the average width of characters in the
font (generally defined as the width of the letter x). This value
does not include the overhang required for bold or italic characters.
PTR.FONT.MAXCHARWIDTH - Specifies the width of the widest character in the font.
PTR.FONT.WEIGHT - Specifies the weight of the font.
<Back to Top>
Color
(SetTextColor = <Red>, <Green>, <Blue>)
Sets the current text color as specified by <Red>, <Green>, <Blue>.
(SetBkColor = <Red>, <Green>, <Blue>)
Sets the current background color as specified by <Red>, <Green>, <Blue>.
Colors are represented by 3 (Red, Green, Blue) color intensity values, each
ranging in value from 0 (no color - black) to 255 (max color - white).
<Red> ! Specifies the amount of RED
<Green> ! Specifies the amount of GREEN
<Blue> ! Specifies the amount of BLUE
(GetTextColor)
Returns the current text color.
(GetBkColor)
Returns the current background color.
The return value for this function is obtained by requesting the result of the previous
operation with (GetFuncResult) and then performing an input of the 4 byte return value
<Back to Top>
BKMode
(SetBkMode = <Mode>)
Sets the background mode specified by <Mode>.
The background mode defines whether the system removes existing background colors on the drawing surface before drawing text, hatched brushes, or any pen style that is not a solid line.
Where <Mode> is:
BKM.OPAQUE Background is filled with the current background color before the text, hatched brush, or pen is drawn. This is the default background mode.
BKM.TRANSPARENT Background is not changed before drawing.
(GetBkMode)
Returns the current background mode.
The return value for this function is obtained by requesting the result of the previous
operation with (GetFuncResult) and then performing an input of the 4 byte return value
<Back to Top>
Printing Text
(SetTextAlign = <Flags>)
Sets the text alignment mode to that specified by <Flags >.
The TextOut function uses these flags when positioning a string of text on a display or device. The flags specify the relationship between a specific point and a rectangle that bounds the text. The coordinates of this point are passed as parameters to the TextOut member function. The rectangle that bounds the text is formed by the adjacent character cells in the text string.
The flags specify the relationship between a point and a rectangle that bounds the text. The point may be either the current position or the coordinates specified by a text-output function. The rectangle that bounds the text is defined by the adjacent character cells in the text string. The <Flags> parameter can be one or more flags from the following three categories. Choose only one flag from each category.
The first category affects text alignment in the x-direction:
TA.CENTER Aligns the point with the horizontal center of the bounding rectangle.
TA.LEFT Aligns the point with the left side of the bounding rectangle.
This is the default setting.
TA.RIGHT Aligns the point with the right side of the bounding rectangle.
The second category affects text alignment in the y-direction:
TA.BASELINE Aligns the point with the base line of the chosen font.
TA.BOTTOM Aligns the point with the bottom of the bounding rectangle.
TA.TOP Aligns the point with the top of the bounding rectangle. (default)
The third category determines whether the current position is updated when text is written:
TA.NOUPDATECP Does not update the current position after each call to a text-output function. This is the default setting.
TA.UPDATECP Updates the current x-position after each call to a text-output function.
The new position is at the right side of the bounding rectangle for the text. When this flag is set, the coordinates specified in calls to the TextOut member function are ignored.
<Back to Top>
(GetTextAlign)
Returns the current text alignment Flags. The resulting flags are returned in <LoWord>.
(GetTextExtent);<Printable Text>
Measures the size (width and height) of the specified <Printable Text>.
The resulting width and height are returned in <LoWord> and <HiWord> (respecively).
The return value for this function is obtained by requesting the result of the previous
operation with (GetFuncResult) and then performing an input of the 4 byte return value
(TextOut = <X>, <Y>); <Printable Text>
Prints the specified <Printable Text> at the location specified by <X> and <Y>.
Character origins are at the upper-left corner of the character cell. By
default, the current position is not used or updated by the function.
If an application needs to update the current position when it calls TextOut,
the application can call the SetTextAlign member function with Flags set to
TA.UPDATECP. When this flag is set, Windows ignores the x and y parameters on
subsequent calls to TextOut, using the current position instead.
<Back to Top>
(DrawText = <Left>, <Top>, <Right>, <Bottom>, <Flags>);<Printable Text>
Prints the specified text <Printable Text> into the rectangle specified by the coordinates <Left>, <Top>, <Right>, <Bottom> using the format codes specified in <Flags>.
This function is used to format text inside the specified rectangle. It formats text by expanding tabs into appropriate spaces, aligning text to the left, right, or center of the rectangle, and breaking text into lines that fit within the rectangle. The type of formatting is specified by <Flags>. The formatting codes can be combined and are specified in <Flags>.
DT.TOP Specifies top-justified text (single line only).
DT.LEFT Aligns text flush-left.
DT.CENTER Centers text horizontally.
DT.RIGHT Aligns text flush-right.
DT.VCENTER Specifies vertically centered text (single line only).
DT.BOTTOM Specifies bottom-justified text. This value must be combined with DT.SINGLELINE.
DT.WORDBREAK Specifies word-breaking. Lines are automatically
broken between words if a word would extend past the edge of the rectangle specified by <Left>, <Top>, <Right>, <Bottom>. A carriage return-line feed sequence will also break the line.
DT.SINGLELINE Specifies single line only. Carriage returns and linefeeds do not break the line.
DT.EXPANDTABS Expands tab characters. The default number of characters per tab is eight.
DT.TABSTOP Sets tab stops. The high-order byte of <PtrFlags> is the number of characters for each tab. The default number of characters per tab is eight.
DT.NOCLIP Draws without clipping. DrawText is somewhat faster when DT.NOCLIP is used.
DT.EXTERNALLEADING Includes the font's external leading in the line height. Normally, external leading is not included in the height of a line of text.
DT.CALCRECT returns the height of the formatted text, but does not draw the text.
DT.NOPREFIX Turns off processing of prefix characters. Normally, DrawText interprets the ampersand (&) mnemonic-prefix character as a directive to underscore the character that follows, and the two-ampersand (&&) mnemonic-prefix characters as a directive to print a single
ampersand. By specifying DT.NOPREFIX, this processing is turned off.
DT.INTERNAL Uses the system font to calculate text metrics.
DT.EDITCONTROL Duplicates the text-displaying characteristics of a
multiline edit control. Specifically, the average
character width is calculated in the same manner as
for an edit control, and the function does not
display a partially visible last line.
DT.PATH.ELLIPSIS See DT.END.ELLIPSIS Below
DT.END.ELLIPSIS Replaces part of the given string with ellipses, if necessary,
so that the result fits in the specified rectangle. The given
string is not modified unless the DT.MODIFYSTRING flag
is specified.
You can specify DT.END.ELLIPSIS to replace characters
at the end of the string, or DT.PATH.ELLIPSIS to replace
characters in the middle of the string. If the string contains
backslash (\) characters, DT.PATH.ELLIPSIS preserves as
much as possible of the text after the last backslash.
DT.MODIFYSTRING Modifies the given string to match the displayed text.
This flag has no effect unless the DT_END_ELLIPSIS or
DT_PATH_ELLIPSIS flag is specified.
DT.RTLREADING Layout in right to left reading order for bi-directional text when
the font selected into the hdc is a Hebrew or Arabic font.
The default reading order for all text is left to right.
DT.WORD.ELLIPSIS Truncates text that does not fit in the rectangle and adds ellipses.
NOTE: The values DT.CALCRECT, DT.EXTERNALLEADING, DT.INTERNAL, DT.NOCLIP, and
DT.NOPREFIX cannot be used with the DT.TABSTOP value.
<Back to Top>
SelectPen
(SelectPen = <Style>, <Width>, <Red>, <Green>, <Blue>)
Selects the pen described by <Style>, <Width> and <Red>, <Green>, <Blue>.
Available pen styles <Style> are:
PS.SOLID Creates a solid pen.
PS.DASH Creates a dashed pen. Valid only when the pen width is 1 or less, in device units.
PS.DOT Creates a dotted pen. Valid only when the pen width is 1 or less, in device units.
PS.DASHDOT Creates a pen with alternating dashes and dots. Valid only when the pen width is 1 or less, in device units.
PS.DASHDOTDOT Creates a pen with alternating dashes and double dots. Valid
only when the pen width is 1 or less, in device units.
PS.NULL Creates a null pen.
PS.INSIDEFRAME Creates a pen that draws a line inside the frame of closed
shapes produced by the Windows GDI output functions that
specify a bounding rectangle (for example, the Ellipse,
Rectangle, RoundRect, Pie, and Chord member functions).
When this style is used with Windows GDI output functions
that do not specify a bounding rectangle (for example, the
LineTo member function), the drawing area of the pen is not
limited by a frame.
If the width of the pen <PtrWidth> is 0, the width in device units is always 1 pixel, regardless of the mapping mode.
NOTE: See SetTextColor for color parameter information.
SelectBrush
(SelectSolidBrush = <Red>, <Green>, <Blue>)
Selects the solid brush described <Red>, <Green>, <Blue>.
NOTE: See SetTextColor for color parameter information.
(SelectHatchBrush = <Style>, <Red>, <Green>, <Blue>)
Selects the hatched brush described <Style> and <Red>, <Green>, <Blue>.
Where <Style> can be one of the following values:
HS.HORIZONTAL Horizontal hatch
HS.VERTICAL Vertical hatch
HS.FDIAGONAL Upward hatch (left to right) at 45 degrees
HS.BDIAGONAL Downward hatch (left to right) at 45 degrees
HS.CROSS Horizontal and vertical crosshatch
HS.DIAGCROSS Crosshatch at 45 degrees
NOTE: See SetTextColor for color parameter information.
<Back to Top>
MoveTo / LineTo
(MoveTo = <X>, <Y>)
Moves the current location pointer to the location specified by <X>, <Y>. Returns: The X and Y coordinates of the previous position in <LoResult> and <HiResult> (respectively).
(LineTo = <X>, <Y>)
Draws a line using the currently selected pen from the current location pointer up to but not including the location specified by <X>, <Y>. The current position is set to <X>, <Y>.
<Back to Top>
Set / Get ROP2
(SetROP2 = <Mode>)
Sets the current foreground mix mode. GDI uses the foreground mix mode to combine pens and interiors of filled objects with the colors already on the screen. The foreground mix mode defines how colors from the brush or pen and the colors in the existing image are to be combined.
Where <Mode> can be any of the following values:
Mix mode
Description
R2.BLACK
Pixel is always 0.
R2.COPYPEN
Pixel is the pen color.
R2.MASKNOTPEN
Pixel is a combination of the colors common to both the screen and the inverse of the pen.
R2.MASKPEN
Pixel is a combination of the colors common to both the pen and the screen.
R2.MASKPENNOT
Pixel is a combination of the colors common to both the pen and the inverse of the screen.
R2.MERGENOTPEN
Pixel is a combination of the screen color and the inverse of the pen color.
R2.MERGEPEN
Pixel is a combination of the pen color and the screen color.
R2.MERGEPENNOT
Pixel is a combination of the pen color and the inverse of the screen color.
R2.NOP
Pixel remains unchanged.
R2.NOT
Pixel is the inverse of the screen color.
R2.NOTCOPYPEN
Pixel is the inverse of the pen color.
R2.NOTMASKPEN
Pixel is the inverse of the R2_MASKPEN color.
R2.NOTMERGEPEN
Pixel is the inverse of the R2_MERGEPEN color.
R2.NOTXORPEN
Pixel is the inverse of the R2_XORPEN color.
R2.WHITE
Pixel is always 1.
R2.XORPEN
Pixel is a combination of the colors in the pen and in the screen, but not in both.
(GetROP2)
Retrieves the foreground mix mode of the specified device context. The mix mode specifies how the pen or interior color and the color already on the screen are combined to yield a new color. The resulting mode is returned in <LoWord>.
<Back to Top>
Ellipse, Rectangle & RoundRect
(Ellipse = <Left>, <Top>, <Right>, <Bottom>)
Draws an ellipse. The center of the ellipse is the center of the bounding rectangle specified by <Left>, <Top>, <Right>, <Bottom>. The ellipse is drawn with the current pen, and its interior is filled with the current brush. The figure drawn by this function extends up to, but does not include, the right and bottom coordinates. This means that the height of the figure is <Bottom> - <Top> and the width of the figure is <Right> - <Left>.
If either the width or the height of the bounding rectangle is 0, no ellipse is drawn.
(Rectangle = <Left>, <Top>, <Right>, <Bottom>)
Draws a rectangle specified by <Left>, <Top>, <Right>, <Bottom> using the current pen. The interior of the rectangle is filled using the current brush. The rectangle extends up to, but does not include, the right and bottom coordinates. This means that the height of the rectangle is<Bottom> - <Top> and the width of the rectangle is <Right> - <Left>. Both the width and the height of a rectangle must be greater than 2 units and less than 32,767 units.
(RoundRect = <Left>, <Top>, <Right>, <Bottom>, <CornerWidth>, <CornerHeight>)
Draws a rectangle with corners rounded using the ellipse specified by <CornerWidth> and <CornerHeight> at the location specified by <Left>, <Top>, <Right>, <Bottom> using the currently selected pen. The interior of the rectangle is filled using the current brush.
See Rectangle above.
<Back to Top>
DrawBitmap
(DrawBitmap = <Left>,<Top>,<Right>,<Bottom>,<ScaleX>,<ScaleY>,<Flags>);<FileName>
Draws the bitmap contained in the file (.BMP/.JPG) specified in <FileName> in the rectangle specified by <Left>, <Top>, <Right>, <Bottom> using the format codes contained in <Flags>. Scaling factors can be specified in <ScaleX>, <ScaleY>.
FileName is a string containing the full path name of the bit map file. No trailing @00@ is needed or expected.
Valid flag are:
BMR.FIT.TO.RECT Stretch (or shrink) bitmap to fit rectangle.
Cannot be used with any other codes
or
BMR.CENTER.HZ.RECT Center the bitmap horizontally in rectangle
BMR.CENTER.VT.RECT Center the bitmap vertically in rectangle
BMR.SCALE Multiply dimensions by scaling factors below
When scaling, values contained in <ScaleX> and <ScaleY> are converted to floating point, divided by 100, and then multiplied
by their respective axis to providing scaling by as little as 1 percent.
Scaling example:
To double only the horizontal size of a bitmap:
<ScaleX> = 200 ! * 2
<ScaleY> = 100 ! * 1
To halve a bitmap
<ScaleX> = 50 ! * .5
<ScaleY> = 50 ! * .5
To convert bitmap pixels to .01 inch:
<ScaleX> = 1440 ! * 14.40 (TWIPS/inch)
<ScaleY> = 1440 ! * 14.40 (TWIPS/inch)
<Back to Top>
Orientation & PageInfo
(SetOrientation = <Mode>)
Sets the paper orientation contained in <Mode>.
Valid values for <Mode> are:
DMORIENT.PORTRAIT Vertical paper alignment
DMORIENT.LANDSCAPE Horizontal paper alignment
(GetPageInfo = <ItemCode>)
Returns the information specified in <ItemCode>
Valid <ItemCode> Values:
PTR.PAGEINFO.PRINTABLESIZE Dimensions of printable area (Width, Height)
PTR.PAGEINFO.PHYSICALSIZE Physical page size (Width, Height)
PTR.PAGEINFO.PHYSICALOFFSET Offset to start of printable area (Left, Top)
PTR.PAGEINFO.LOGPIXELS Number of pixels per inch (Width, Height)
The return value for this function is obtained by requesting the result of the previous operation with (GetFuncResult) and then performing an input of the 4 byte return value The paired values are returned in <LoResult> and <HiResult> respectively.
<Back to Top>
GetFuncResult
(GetFuncResult)
Requests the 32 bit (4 byte) result of the last printer function. This function must be followed immediately by an INPUT statement to receive the value into the MTB program.
Example:
! Variables for GetFuncResult
Length 2 & Local Word$ ! Temporary 2 byte word holder
Length 4 & Local Result$ ! 4 byte string result
Length 5.0 & Local LoResult, HiResult ! Lower/upper 16 bit value
Length 10.0 & Local BigResult ! 32 bit value
! Variables for GetPageSize
Length 5.0 & Local PageWidth, PageHeight ! Printable page size
! Program segment
.
.
Gosub GetPageSize ! Define printer page size
.
.
.
GetPageSize:
Print (LUN) (GetPageInfo = PTR.PAGEINFO.PRINTABLESIZE)
Gosub GetFuncResult ! Get low and high 16 bit results
PageWidth = LoResult ! Store resulting page width
PageHeight = HiResult ! Store resulting page height
Return
GetFuncResult:
Print (LUN) (GetFuncResult) ! Request result
Input (LUN) Result$ ! Input result
Word$ = SUB(Result$,2,1)+ Result$ ! Get and reverse 1st 2 bytes
LoResult = HEXDEC(Word$) ! Convert to MTB numeric
Word$ = SUB(Result$,4,1)+SUB(Result$,3,1) ! Get and reverse 2nd 2 bytes
HiResult = HEXDEC(Word$) ! Convert to MTB numeric
BigResult = HiResult*65536+LoResult ! Combined 32 bit numeric value Return
<Back to Top>