Sunteți pe pagina 1din 27

PrinterCE Methods & Properties

About
READ-ONLY property returns string describing this version of PrinterCE/AsciiCE/BarcodeCE.

MFC Syntax: Cstring str =PrinterCE1.GetAbout();


C++ Syntax: PrinterCE1.get_About(BSTR* str);
eVB Syntax: str=PrinterCE1.About

Returns

String describing this version of PrinterCE - including information on WinCE platform (Pocket PC,
HPC/Pro), processor type and version. This string can be used in a MsgBox() to display the information.

Capabilities
READ-ONLY property returns bit-values that identify all the capabilities in the current control.

MFC Syntax: long bitvals =PrinterCE1.GetCapabilities();


C++ Syntax: PrinterCE1.get_Capabilities(long * bitvals);
eVB Syntax: bitvals = PrinterCE1.Capabilities

Returns

Bit values that identify the capabilities of the current control:

Constant Setting Description


CAPS_STD 01h PrinterCE Standard capabilities
CAPS_PLUS 02h PrinterCE SDK
CAPS_ASCII 04h AsciiCE
CAPS_BARCODE 08h BarcodeCE
CAPS_ASCII2 10h AsciiCE2
CAPS_PRINTDC 20h PrintDC

ConvertCoord
This method converts a value from one ScaleMode system to another.

MFC Syntax: float toval=PrinterCE1.ConvertCoord(float fromval, long fromscale, long toscale);


C++ Syntax: PrinterCE1.ConvertCoord(float fromval, long fromscale, long toscale,float* toval);
eVB Syntax: toval = PrinterCE1.DrawConvertCoord fromval, fromscale, toscalee

Parameters

fromval - Value to be converted


fromscale - "convert from" ScaleMode
toscale - "convert to" ScaleMode.

Returns
toval - Converted value.

Example:

To convert 1.25 inches into printer resolution: PrResVal=PrCE1.ConvertCoord(1.25,vbInches,vbPixels)

DrawCircle
This method prints a circle or ellipse on a page.

MFC Syntax: PrinterCE1.DrawCircle(float x, float y,float rad, VARIANT* color, VARIANT* aspect);
C++ Syntax: PrinterCE1.DrawCircle(float x, float y,float rad, VARIANT* color, VARIANT* aspect);
eVB Syntax: PrinterCE1.DrawCircle x, y, [color], [aspect]

Parameters

x - Horizontal coordinate for the center point of a circle.


y - Vertical coordinate for the center point of a circle.
radius - Radius of a circle.
color – Optional - RGB color of a circle's outline. If omitted (or NULL), the ForeColor value is used.
aspect – Optional - aspect ratio of a circle. The default value is 1.0, which yields a perfect circle. Other
values draw an ellipse. (Also see DrawEllipse for another way to draw ellipses).

Remarks

The ScaleMode property of object determines the units of measure used. The FillColor and FillStyle
properties of object determine how a circle is filled.
The DrawWidth property determines the width of the line used to draw a circle.

DrawEllipse
This method prints an ellipse on a page.

MFC Syntax: PrinterCE1.DrawEllipse(float x1, float y1, float x2, float y2, VARIANT* color);
C++ Syntax: PrinterCE1.DrawEllipse(float x1, float y1, float x2, float y2, VARIANT* color);
eVB Syntax: PrinterCE1.DrawEllipse x1, y1, x2, y2, [color]

Parameters

x1, y1, x2, y2 - Required. Values define a rectangle (x1,y1) as one corner and (x2,y2) as opposing corner.
An ellipse is drawn that just fits within this bounding rectangle. .
color – Optional - RGB color of a circle's outline. If omitted, the ForeColor value is used.

Remarks

The ScaleMode property of object determines the units of measure used. The FillColor and FillStyle
properties of object determine how a circle is filled.
The DrawWidth property determines the width of the line used to draw a circle.

DrawLine
This method draws lines and rectangles on a Form.

MFC Syntax: PrinterCE1.DrawLine(float x1, float y1, float x2, float y2, VARIANT* color, VARIANT* boxfill);
C++ Syntax: PrinterCE1.DrawLine(float x1, float y1, float x2, float y2, VARIANT* color, VARIANT* boxfill);
eVB Syntax: PrinterCE1.DrawLine x1, y1, x2, y2, [color], [boxfill]

Parameters

x1, y1 - starting coordinates for a line or rectangle


x2, y2 - ending coordinates for a line or rectangle.
color – Optional - RGB color used to draw a line. If omitted/NULL, the ForeColor value is used.
boxfill – Optional – If omitted or NULL, simple line is drawn. if = vbLineBox causes a box to be drawn
using the coordinates to specify opposite corners of the box. vbLineBoxFill specifies that the box is filled
with the same color used to draw the box. (See DrawRect and DrawRoundedRect for other ways to draw
rectangles)

Remarks

The DrawWidth property determines the width of the line. The ScaleMode property determines the unit of
measure used.

boxfill Value
vbLineBox 1 Draws box using coords as opposite corners
vbLineBoxFill 2 Draws box and fills with line color

DrawPicture
This method prints a BMP, JPG, GIF or PNG image file on the page. Note: A few non-Pocket PC devices
may not include full image support (BMP should always be supported). You can test your device to verify
what file types are supported.

MFC Syntax: PrinterCE1.DrawPicture(BSTR picture,float x,float y,VARIANT* width,VARIANT* height,VARIANT* keepaspect);


C++ Syntax: PrinterCE1.DrawPicture(BSTR picture,float x,float y,VARIANT* width,VARIANT* height,VARIANT* keepaspect);
eVB Syntax: PrinterCE1.DrawPicture picture, x, y, [width], [height], [keepaspect]

Parameters

picture : Path & filename of the image to be drawn.


x,y : Coordinates where picture will be drawn (in ScaleMode units). By default, x,y is the top/left corner of the
image location. Use JustifyHoriz/JustifyVert to change this to Center or Bottom/Right.
width : Optional destination width of picture. If omitted or if zero, the actual image width is used.
height : Optional destination height of picture. If omitted or if zero, the actual image height is used.
keepaspect :

keepaspect value Description


Aspect Ratio (width to height of original image is retained. Image is sized
TRUE
to fit inside area of "width" x "height"
FALSE (default) Image is stretched or scrunched to fit within "width" x "height"
Returns actual width and height of image in "width" and "height" values...
NO PICTURE IS DRAWN!. Uses ScaleMode to determine unit of
2
measure for width & height values. Input values for x, y, width and height
are not used when determining and returning image width and height.

Remarks

If width and/or height are negative values, DrawPicture creates a mirror image along the vertical axis (if
width is negative) and/or the horizontal axis (if height is negative).
DrawPoint
This method draws a point on the page.

MFC Syntax: PrinterCE1.DrawPoint(float x, float y,VARIANT* color);


C++ Syntax: PrinterCE1.DrawPoint(float x, float y,VARIANT* color);
eVB Syntax: PrinterCE1.DrawPoint x, y, [color]

Parameters

x, y - Coordinates of the point to draw (in ScaleMode units)


color - Optional. RGB color for point. If omitted/NULL, the current ForeColor value setting is used.

Remarks

The setting of the DrawWidth property determines the size of the point.

DrawRect
This method draws a rectangle on a page.

MFC Syntax: PrinterCE1.DrawRect(float x1, float y1, float x2, float y2, VARIANT* color);
C++ Syntax: PrinterCE1.DrawRect(float x1, float y1, float x2, float y2, VARIANT* color);
eVB Syntax: PrinterCE1.DrawRect x1, y1, x2, y2, [color]

Parameters

x1, y1, x2, y2 - defines a rectangle with (x1,y1) as one corner and (x2,y2) as opposing corner
color – Optional - RGB color of rectangle’s outline. If omitted/NULL, the ForeColor value is used

Remarks

Coordinates are in ScaleMode units. FillColor and FillStyle properties of object


determine how a rectangle is filled. The DrawWidth property determines the
width of the line used to draw a rectangle.

DrawRoundedRect
This method draws a rectangle with rounded corners on a page.

MFC Syntax: PrinterCE1.DrawRoundedRect(float x1, float y1, float x2, float y2, float cornerwidth, float
cornerheight, VARIANT* color);
C++ Syntax: PrinterCE1.DrawRoundedRect(float x1, float y1, float x2, float y2, float cornerwidth, float
cornerheight, VARIANT* color);
eVB Syntax: PrinterCE1. DrawRoundedRect x1,y1,x2,y2,cornerwidth,cornerheight, [color]

Parameters

x1, y1, x2, y2 - Defines a rectangle with (x1,y1) as one corner and (x2,y2) as opposing corner.
cornerwidth,cornerheight - defines the width and height of the curve of the rounded rectangle..
color - Optional. RGB color of a rectangle’s outline. If omitted/NULL, the ForeColor value is used.

Remarks
Coordinates are in ScaleMode units. FillColor and FillStyle properties of object determine how a rectangle
is filled. The DrawWidth property determines the width of the line used to draw a rectangle.

DrawText
This method draws text on the page.

MFC Syntax: PrinterCE1.DrawText(LPSTSTR str, VARIANT* x VARIANT* y, VARIANT* count);


C++ Syntax: PrinterCE1.DrawText(BSTR str, VARIANT* x VARIANT* y, VARIANT* count);
eVB Syntax: PrinterCE1.DrawText string, [x], [y], [count]

Parameters

string - Text to be drawn.


x, y - Optional. Coordinates of the text to be drawn. If not specified or NULL, string is drawn at the intrinsic
(TextX,TextY) coordinates.
count - Optional. Number of characters in "string" that should be printed – if not specified or NULL then
entire line of text is drawn.

Remarks

The font properties of the PrinterCE control determines the appearance of the text. The ForeColor
property determines the color of the text. After the text is drawn, TextX, TextY are updated so that the
next DrawText command will print on a new line. The JustifyHoriz, JustifyVert, and Rotation properties all
impact how and where the text is actually drawn on the page. Coordinates are in ScaleMode units

DrawWidth
This property returns and sets the line width for output from a graphics method.

MFC Syntax: float size =PrinterCE1.GetDrawWidth();


PrinterCE1.SetDrawWidth(float size);
C++ Syntax: PrinterCE1.get_DrawWidth(float * size);
PrinterCE1.put_DrawWidth(float size);
eVB Syntax: PrinterCE1.DrawWidth [=size]

Parameters

size –Value for the width of the line in the current ScaleMode. For example, if ScaleMode is set to Inches,
size of 0.1 would select a line width of 1/10 of an inch. A size of 0 sets line width to 1 pixel.

EndDoc
This method causes the current page to be printed and resets printing properties to default.

MFC Syntax: PrinterCE1.EndDoc();


C++ Syntax: PrinterCE1.EndDoc();
eVB Syntax: PrinterCE1.EndDoc

Remarks

Causes the current page to be printed and then resets all properties to their default settings. See also
"NewPage".
FillColor
This property returns and sets the color used to fill in graphics methods: DrawRect, DrawRoundedRect,
DrawCircle and DrawEllipse.

MFC Syntax: long value =PrinterCE1.GetFillColor();


PrinterCE1.SetFillColor(long value);
C++ Syntax: PrinterCE1.get_FillColor(long * value);
PrinterCE1.put_FillColor(long value);
eVB Syntax: PrinterCE1.FillColor [=value]

Parameters

value - Standard RGB color value that determines the fill color. By default, FillColor is set to 0 (Black).

Remarks

When the FillStyle property is set to Transparent (default), the FillColor setting is ignored. The valid range
for a normal RGB color is from 0 through 16,777,215 (&HFFFFFF). The high byte of a number in this
range equals 0. The lower 3 bytes, from least to most significant byte, determine the amount of red,
green, and blue, respectively. The red, green, and blue components are each represented by a number
from 0 through 255 (&HFF).

FillStyle
This property returns and sets the pattern used to fill in graphics methods: DrawRect, DrawRoundedRect,
DrawCircle and DrawEllipse.

MFC Syntax: long value =PrinterCE1.GetFillStyle();


PrinterCE1.SetFillStyle(long value);
C++ Syntax: PrinterCE1.get_FillStyle(long * value);
PrinterCE1.put_FillStyle(long value);
eVB Syntax: PrinterCE1.FillStyle [=value]

Parameters

value - Integer that specifies the fill style. The following table describes the settings for number.

Constant Setting Description


picFSSolid 0 Solid
picFSTransparent 1 (default) Transparent

Remarks

When the FillStyle property is set Transparent, the FillColor setting is ignored.

FontBold
This property returns and sets the Bold font style.

MFC Syntax: long value =PrinterCE1.GetFontBold();


PrinterCE1.SetFontBold(long value);
C++ Syntax: PrinterCE1.get_FontBold(long * value);
PrinterCE1.put_FontBold(long value);
eVB Syntax: PrinterCE1.FontBold [=value]

Parameters

value - Boolean expression that specifies the font style. Following are the settings for Boolean:
True - Turns on Bold formatting, False - Turns off Bold formatting.

Remarks

Sets the "current font settings" to Bold or Normal. For more selective settings, see FontBoldVal property.

FontBoldVal
This property returns and sets the Bold font style.

MFC Syntax: long value =PrinterCE1.GetFontBoldVal();


PrinterCE1.SetFontBoldVal(long value);
C++ Syntax: PrinterCE1.get_FontBoldVal(long * value);
PrinterCE1.put_FontBoldVal(long value);
eVB Syntax: PrinterCE1.FontBoldVal [=value]

Parameters

value - Integer value between 0 and 1000 to set the weight of the font. Normal weight setting is 400 and
standard Bold is 700.

Remarks

Sets the "current font settings" to selected weight..

FontItalic
This property returns and sets the Italic font style.

MFC Syntax: long value =PrinterCE1.GetFontItalic();


PrinterCE1.SetFontItalic(long value);
C++ Syntax: PrinterCE1.get_FontItalic(long * value);
PrinterCE1.put_FontItalic(long value);
eVB Syntax: PrinterCE1.FontItalic [=value]

Parameters

value - Boolean expression that specifies the font style. Following are the settings for Boolean:
True - Turns on the formatting in that style, False - Turns off the formatting in that style (default)

Remarks

Use these font properties to format text.

FontName
This property returns and sets the font used to print text..

MFC Syntax: Cstring font =PrinterCE1.GetFontName();


PrinterCE1.SetFontName(BSTR font);
C++ Syntax: PrinterCE1.get_FontName(BSTR* font);
PrinterCE1.put_FontName(BSTR font);
eVB Syntax: PrinterCE1.FontName [=font]

Parameters

font - String expression that specifies the font name to use.

Remarks

Any TrueType font can be used. To install a TrueType font to the device, simply copy from desktop PC to
\Windows\Fonts folder on the device. You can use Pocket Word -> Edit -> Format -> pull down list of
available fonts to see exact font names of all installed fonts.

FontSize
This property returns and sets the size of the font to be used for printing.

MFC Syntax: long value =PrinterCE1.GetFontSize();


PrinterCE1.SetFontSize(long value);
C++ Syntax: PrinterCE1.get_FontSize(long * value);
PrinterCE1.put_FontSize(long value);
eVB Syntax: PrinterCE1.FontSize [=value]

Parameters

value – Numeric expression that specifies the font size, in points, to use.

Remarks

Note: to match a point size with equivalent point size of Microsoft Word, use negative point size... for
example, to match Word's 12 point font, use PrinterCE1.FontSize = -12.

The maximum value for FontSize is 2,160 points. The minimum value is 4 points.

FontStrikethru
This property returns and sets the Strikethrough style.

MFC Syntax: long value =PrinterCE1.GetFontStrikethru();


PrinterCE1.SetFontStrikethru(long value);
C++ Syntax: PrinterCE1.get_FontStrikethru(long * value);
PrinterCE1.put_FontStrikethru(long value);
eVB Syntax: PrinterCE1.FontStrikethru [=value]

Parameters

value - Boolean expression specifying the font style. Following are the settings for Boolean:
True - Turns on the strike-through formatting. False - Turns off the strike-through formatting (default)

FontUnderline
This property returns and sets the Underline font style.
MFC Syntax: long value =PrinterCE1.GetFontUnderline();
PrinterCE1.SetFontUnderline(long value);
C++ Syntax: PrinterCE1.get_FontUnderline(long * value);
PrinterCE1.put_FontUnderline(long value);
eVB Syntax: PrinterCE1.FontUnderline [=value]

Parameters

value - Boolean expression that specifies the font style. Following are the settings for Boolean:
True - Turns on the underline formatting. False - Turns off the underline formatting (default)

ForeColor
This property returns and sets the foreground color used to print text.

MFC Syntax: long value =PrinterCE1.GetForeColor();


PrinterCE1.SetForeColor(long value);
C++ Syntax: PrinterCE1.get_ForeColor(long * value);
PrinterCE1.put_ForeColor(long value);
eVB Syntax: PrinterCE1.ForeColor [=value]

Parameters

value – RGB color value. Default color is set to Black.

Remarks

The valid range for a normal RGB color is from 0 through 16,777,215 (&HFFFFFF). The high byte of a
number in this range equals 0. The lower 3 bytes, from least to most significant byte, determine the
amount of red, green, and blue, respectively. The red, green, and blue components are each represented
by a number from 0 through 255 (&HFF).

GetStringHeight
READ-ONLY Property - Returns the height of the given text string (in ScaleMode units)

MFC Syntax: float value =PrinterCE1.GetGetStringHeight(BSTR string);


C++ Syntax: PrinterCE1.get_GetStringHeight(BSTR string, float* value);
eVB Syntax: value=PrinterCE1.GetStringHeight(string)

Parameters

string – Text string

Returns

value – returns height of text string for currently selected font in ScaleMode units

GetStringWidth
READ-ONLY Property - Returns the width of the given text string (in ScaleMode units)

MFC Syntax: float value =PrinterCE1.GetGetStringWidth(BSTR string);


C++ Syntax: PrinterCE1.get_GetStringWidth(BSTR string, float* value);
eVB Syntax: value=PrinterCE1.GetStringWidth(string)

Parameters

string – Text string

Returns

value – returns width of text string for currently selected font in ScaleMode units

GetVersion
READ-ONLY Property - Returns an integer value representing the version of PrinterCE

MFC Syntax: long value =PrinterCE1.GetGetVersion();


C++ Syntax: PrinterCE1.get_GetVersion(long * value);
eVB Syntax: value = PrinterCE1.GetVersion

Returns

value - Integer representation of version = (Major * 1000) + Minor.


Example: version 1.3 would return value of 1300.

Init
This method registers PrinterCE (or AsciiCE) with the application's RegID string to verify that the app is
licensed to use the printer functions.

MFC Syntax: long retval=PrinterCE1.Init(BSTR regidstring);


C++ Syntax: PrinterCE1.Init(BSTR regidstring,long *retval);
eVB Syntax: retval=PrinterCE1.Init regidstring

Parameters

regidstring - registration id string provided when the PrinterCE license is purchased. This will identify
which version of PrinterCE is licensed and permit all licensed functions to work.

retval - boolean return value - True if registration was successful, false otherwise.

Remarks

If Init() is not called or is not successful, then the registry is queried to see if the user has registered a
single-use license. If not, then an "evaluation" version (30-day time limit) allows the user to continue
printing

IsColor
This READ-ONLY property returns TRUE if current selected printer can print color.

MFC Syntax: long value =PrinterCE1.GetIsColor();


C++ Syntax: PrinterCE1.get_IsColor(long * value);
eVB Syntax: value = PrinterCE1.IsColor

Returns
value – Boolean – TRUE if both printer and printer driver can print in color.

JustifyHoriz
This property returns and sets a value that determines the horizontal justification of following DrawText
and DrawImage methods.

MFC Syntax: long value =PrinterCE1.GetJustifyHoriz();


PrinterCE1.SetJustifyHoriz(long value);
C++ Syntax: PrinterCE1.get_JustifyHoriz(long * value);
PrinterCE1.put_JustifyHoriz(long value);
eVB Syntax: PrinterCE1.JustifyHoriz [=value]

Parameters

value - Integer that specifies horizontal justification of text and images. The following table describes the
settings for number.

Constant Setting Description


vbLeftJustify 0 (default) TextX is Left of text/image
vbRightJustify 1 TextX is Right of text/image
vbCenter 2 TextX is Center of text/image

JustifyVert
This property returns and sets a value that determines the vertical justification of following DrawText and
DrawImage methods..

MFC Syntax: long value =PrinterCE1.GetJustifyVert();


PrinterCE1.SetJustifyVert(long value);
C++ Syntax: PrinterCE1.get_JustifyVert(long * value);
PrinterCE1.put_JustifyVert(long value);
eVB Syntax: PrinterCE1.JustifyVert [=value]

Parameters

value - Integer that specifies vertical justification of text and images. The following table describes the
settings for number.

Constant Setting Description


vbTopJustify 0 (default) TextY is Top of text/image
vbBottomJustify 1 TextY is Bottom of text/image
vbCenter 2 TextY is Center of text/image

KillDoc
This method clears any printing commands and resets printing properties to default.

MFC Syntax: PrinterCE1.KillDoc();


C++ Syntax: PrinterCE1.KillDoc();
eVB Syntax: PrinterCE1.KillDoc
Remarks

Causes the current page to be deleted (not printed) and then resets all properties to their default settings.

NewPage
This method causes the current page to be printed.

MFC Syntax: PrinterCE1.NewPage();


C++ Syntax: PrinterCE1.NewPage();
eVB Syntax: PrinterCE1.NewPage

Remarks

Causes the current page to be printed. All properties except for TextX,TextY remain unchanged. See also
"EndDoc".

PgIndentLeft
This property returns and sets an indent from the left margin of the page where the start of the horizontal
printing is found.

MFC Syntax: long value =PrinterCE1.GetPgIndentLeft();


PrinterCE1.SetPgIndentLeft(long value);
C++ Syntax: PrinterCE1.get_PgIndentLeft(long * value);
PrinterCE1.put_PgIndentLeft(long value);
eVB Syntax: PrinterCE1.PgIndentLeft [=value]

Parameters

value - Numeric expression that specifies margin distance. The value is in printer resolution dots.

Note: To determine the printer resolution after SelectPrinter() or SetupPrinter(), do:


PrinterResolution = PrinterCE1.ConvertCoord(1,vbInches, vbPixels)

Remarks

The PgIndentLeft and PgIndentTop settings can be called multiple times while printing one page. All
subsequent drawing methods use the new settings (but prior drawing methods do not). Use this technique
to easily print multiple columns and/or rows of items.

PgIndentTop
This property returns and sets an indent from the top margin of the page where the start of the vertical
printing is found.

MFC Syntax: long value =PrinterCE1.GetPgIndentTop();


PrinterCE1.SetPgIndentTop(long value);
C++ Syntax: PrinterCE1.get_PgIndentTop(long * value);
PrinterCE1.put_PgIndentTop(long value);
eVB Syntax: PrinterCE1.PgIndentTop [=value]

Parameters
value - Numeric expression that specifies margin distance. The value is in printer resolution dots.

Note: To determine the printer resolution after SelectPrinter() or SetupPrinter(), do:


PrinterResolution = PrinterCE1.ConvertCoord(1,vbInches, vbPixels)

Remarks

The PgIndentLeft and PgIndentTop settings can be called multiple times while printing one page. All
subsequent drawing methods use the new settings (but prior drawing methods do not). Use this technique
to easily print multiple columns and/or rows of items.

PrBottomMargin
This property returns and sets the bottom margin for the printed page

MFC Syntax: float value =PrinterCE1.GetPrBottomMargin();


PrinterCE1.SetPrBottomMargin(float value);
C++ Syntax: PrinterCE1.get_PrBottomMargin(float * value);
PrinterCE1.put_PrBottomMargin(float value);
eVB Syntax: PrinterCE1.PrBottomMargin [=value]

Parameters

value - Numeric expression that specifies margin distance. The value is in ScaleMode units. Default is
printer default margin value.

PrDialogBox
This method controls action of the "Printing in progress" dialog box (which allows the user to cancel the
print operation).

MFC Syntax: long retval=PrinterCE1.PrDialogBox(long operation);


C++ Syntax: PrinterCE1. PrDialogBox(long operation,long* retval);
eVB Syntax: retval=PrinterCE1. PrDialogBox operation

Parameters

operation – One of the following values:

Constant Setting Description


Uses "in progress" dialog box to show details about
vbDlgBoxDebugOn -1 internal mode of PrinterCE during printing.
(Off by default).
vbDlgBoxDebugOff -2 Turns off Debug mode.
vbDlgBoxUp 0 Display "in progress" dialog box
vbDlgBoxDown 1 Take down dialog box
vbDlgBoxDisable 2 Prevent dialog box from being used
vbDlgBoxStatus 3 Display status of printing operation
vbDlgBoxUserCancel 4 Return True if user cancelled printing operation
vbDlgBoxAbortError 5 Return True if an error aborted printing operation

Return Value
retval - Current status of operation (see table above). If not user cancel or AbortError, then returns current
status of printer dialog box (vbDlgUp, etc).

Remarks

By default, the "Printing in progress" dialog box is displayed with the first call by VB to a PrinterCE page
operation (such as Select Printer, Draw Object, etc). This dialog box will remain until EndDoc or KillDoc
completes the printing job. Calling PrDialogBox(vbDlgDisable) will prevent PrinterCE from displaying the
dialog box (and will not give the user any chance to cancel).

See PrDialogBoxText() for info on changing the text displayed or language used by this dialog.

PrDialogBoxText
This method allows changing the text displayed or language used by the "Printing in progress" dialog box.

MFC Syntax: PrinterCE1.PrDialogBoxText(BSTR MainStr,BSTR TitleStr,BSTR CancelBtnStr);


C++ Syntax: PrinterCE1. PrDialogBoxText(BSTR MainStr,BSTR TitleStr,BSTR CancelBtnStr);
eVB Syntax: PrinterCE1. PrDialogBoxText MainStr,TitleStr,CancelBtnStr

Parameters

MainStr - String for main text portion of the "Printing in progress" dialog box.
TitleStr - String for title portion of the "Printing in progress" dialog box.
CancelBtnStr - String for Cancel Button portion of the "Printing in progress" dialog box

Remarks

The text of this dialog box may be changed at any time… if the dialog box is already displayed, it will be
taken down, the new text added, and then the dialog box will be redisplayed. If the dialog box is not
currently displayed, it will remain down until a call to PrDialogBox() or until PrinterCE automatically
displays it.

PrLeftMargin
This property returns and sets the left margin for the printed page

MFC Syntax: float value =PrinterCE1.GetPrLeftMargin();


PrinterCE1.SetPrLeftMargin(float value);
C++ Syntax: PrinterCE1.get_PrLeftMargin(float * value);
PrinterCE1.put_PrLeftMargin(float value);
eVB Syntax: PrinterCE1.PrLeftMargin [=value]

Parameters

value - Numeric expression that specifies margin distance. The value is in ScaleMode units. Default is
printer default margin value.

PrRightMargin
This property returns and sets the right margin for the printed page

MFC Syntax: float value =PrinterCE1.GetPrRightMargin();


PrinterCE1.SetPrRightMargin(float value);
C++ Syntax: PrinterCE1.get_PrRightMargin(float * value);
PrinterCE1.put_PrRightMargin(float value);
eVB Syntax: PrinterCE1.PrRightMargin [=value]

Parameters

value - Numeric expression that specifies margin distance. The value is in ScaleMode units. Default is
printer default margin value.

PrSetDefaults
This method causes the printer control to reset all printer-specific values to the printer defaults.

MFC Syntax: PrinterCE1.PrSetDefaults();


C++ Syntax: PrinterCE1.PrSetDefaults();
eVB Syntax: PrinterCE1.PrSetDefaults

PrTopMargin
This property returns and sets the Top margin for the printed page

MFC Syntax: float value=PrinterCE1.GetPrTopMargin();


PrinterCE1.SetPrTopMargin(float value);
C++ Syntax: PrinterCE1.get_PrTopMargin(float * value);
PrinterCE1.put_PrTopMargin(float value);
eVB Syntax: PrinterCE1.PrTopMargin [=value]

Parameters

value - Numeric expression that specifies margin distance. The value is in ScaleMode units. Default is
printer default margin value.

PrOrientation
This property returns and sets the orientation of the printed page (portrait or landscaped)

MFC Syntax: long value=PrinterCE1.GetPrOrientation();


PrinterCE1.SetPrOrientation(long value);
C++ Syntax: PrinterCE1.get_PrOrientation(long * value);
PrinterCE1.put_PrOrientation(long value);
eVB Syntax: PrinterCE1. PrOrientation [=value]

Parameters

value – Orientation: vb Portrait=1, vb Landscape=2

Constant Setting Description


vbPortrait 1 (default) Normal page orientation
vbLandscape 2 Page rotated landscape

PrPaperSelection
This property returns and sets the paper selection for the printed page: Letter size or A4.
MFC Syntax: long value=PrinterCE1.GetPrPaperSelection();
PrinterCE1.SetPrPaperSelection(long value);
C++ Syntax: PrinterCE1.get_PrPaperSelection(long * value);
PrinterCE1.put_PrPaperSelection(long value);
eVB Syntax: PrinterCE1. PrPaperSelection [=value]

Parameters

value – Letter size=1, A4=2 – Note: defaults to printer default setting.

Constant Setting Description


vbLetter 1 Letter size paper
vbA4 2 A4 paper

PrPgHeight
READ-ONLY Property - Returns the current height of the printable area of the page (after subtracting out
Top & Bottom margins).

MFC Syntax: float value =PrinterCE1.GetPrPgHeight();


C++ Syntax: PrinterCE1.get_PrPgHeight(float * value);
eVB Syntax: value = PrinterCE1.PrPgHeight

Returns

value - Numeric value of the page height in the current ScaleMode units.

PrPgWidth
READ-ONLY Property - Returns the current width of the printable area of the page (after subtracting out
Left & Right margins).

MFC Syntax: float value =PrinterCE1.GetPrPgWidth();


C++ Syntax: PrinterCE1.get_PrPgWidth(float * value);
eVB Syntax: value = PrinterCE1.PrPgWidth

Parameters

value - Numeric value of the page width in the ScaleMode units.

PrPrintQuality
This property returns and sets the quality of the printing – High vs Draft

MFC Syntax: long value=PrinterCE1.GetPrPrintQuality();


PrinterCE1.SetPrPrintQuality(long value);
C++ Syntax: PrinterCE1.get_PrPrintQuality(long * value);
PrinterCE1.put_PrPrintQuality(long value);
eVB Syntax: PrinterCE1.PrPrintQuality [=value]

Parameters

value – Quality: High =1, Draft=2


Constant Setting Description
vbHigh 1 (default) High quality print
vbDraft 2 Draft quality print

Remarks

Many printers do not support DRAFT "print quality".

Rotation
This property returns and sets a value that determines the rotation of subsequent text and image drawing
commands.

MFC Syntax: long value=PrinterCE1.GetRotation();


PrinterCE1.SetRotation(long value);
C++ Syntax: PrinterCE1.get_Rotation(long * value);
PrinterCE1.put_Rotation(long value);
eVB Syntax: PrinterCE1. Rotation [=value]

Parameters

value - Integer that specifies four available rotations

Constant Setting Description


vbNorth 0 (default) Rotation is 0 degrees
vbEast 1 Rotation is 90 degrees clockwise
vbSouth 2 Rotation is 180 degrees
vbWest 3 Rotation is 270 degrees clockwise

Remarks

Images and text can be printed at 90 degree rotations and intermixed freely on the same page. For
example, you can print a text string in the default rotation North, call the Rotation method = 180 and then
print another string upside-down.

The trickiest part of using Rotation is getting a mental image of how the text strings and images will be
positioned on a page. For example, if you have justification set to Left and Top justify the usage of TextX
and TextY will be used to justify the text string or image based on the rotation setting.

ScaleMode
This property returns and sets a value that indicates the unit of measurement for coordinates of printing
objects

MFC Syntax: long value=PrinterCE1.GetScaleMode();


PrinterCE1.SetScaleMode(long value);
C++ Syntax: PrinterCE1.get_ScaleMode(long * value);
PrinterCE1.put_ScaleMode(long value);
eVB Syntax: PrinterCE1.ScaleMode [=value]

Parameters

value - Integer that specifies the unit of measurement. The following table shows the settings for value.
Constant Setting Description
1
vbTwips Twip 1,440 twips per inch. 567 twips per centimeter
(default)
vbPoints 2 Point (72 points per logical inch)
vbPixels 3 Pixel (smallest unit of printer resolution
vbInches 5 Inch
vbMillimeters 6 Millimeter
vbCentimeters 7 Centimeter

SelectPrinter
This method pops up the Printer Dialog box to allow the user to select the printer and printer options to be
used for printing.

MFC Syntax: PrinterCE1.SelectPrinter();


C++ Syntax: PrinterCE1.SelectPrinter();
eVB Syntax: PrinterCE1.SelectPrinter

Remarks

If SelectPrinter is never called, the default printer and settings are used.

SetErrorLevel
This Write-Only property sets error level of errors returned by PrinterCE.

MFC Syntax: PrinterCE1.SetSetErrorLevel(long value);


C++ Syntax: PrinterCE1.put_SetErrorLevel(long value);
eVB Syntax: PrinterCE1.SetErrorLevel =value

Parameters

value - Integer that specifies four available error levels

Constant Setting Description


No errors are returned – Use StatusCheck to watch
vbErrLevelNone 0 (default)
progress
vbErrLevelAll 1 All errors are returned
Only errors that force abort of current operation or of
vbErrLevelTask 2
printer job are returned
Only errors forcing abort of the printer job are
vbErrLevelJob 3
returned

Remarks

There are two approaches that a VB program can take while using PrinterCE… first is to set up "On Error"
statements in each sub or function that calls a PrinterCE method or property and use the "On Error"
handler to determine the course of action when an error occurs within PrinterCE. The second approach is
to use occasional calls to StatusCheck to determine if an error has occurred.

When an error occurs within PrinterCE, the severity of the error is determined and PrinterCE "remembers"
this as appropriate. So, for example, if a printer error occurs, the entire printing job must be aborted, so all
calls to PrinterCE will remember that it is aborting and this will be handled gracefully. However, if the error
is an "image file not found" error from a "DrawPicture" method, that current DrawPicture task must be
aborted, but the rest of the print job can continue.

This structure allows the VB program that uses PrinterCE to have a relaxed approach to error handling,
even to the point of ignoring errors completely (although it would be kind to the user to do StatusCheck
calls and display error dialog boxes as needed).

C++ and MFC-based applications can use the StatusCheck() method to determine if some error or user
action has caused AsciiCE to stop printing. Since AsciiCE stops trying to print once an error or user
cancel has been found, StatusCheck() only needs to be called when the application may be entering
some extended period of activity.

NOTE to eVB developers: Feedback we have gotten from eVB users is that eVB error trapping seems to
create more problems than it solves. My recommendation is to not use eVB "On Error" type trapping at
all. Simply use StatusCheck to determine if any
errors have occurred and handle as you wish.

Most apps actually only need to call StatusCheck for checking PrinterCE errors in two places:

- Right after SelectPrinter call - because this is the most common place the user might Cancel or a printer
connection error might occur (such as trying to establish an Infrared connection with no IR printer in
range).

- Right after call to EndDoc (and NewPage if you are printing multiple pages). This lets you determine if
an error was found between SelectPrinter and end of printing the page. If a vbAbortPrint error occurs after
SelectPrinter and before EndDoc, all PrinterCE functions will simply see the error condition and
immediately return until EndDoc, which resets the error condition and prepares PrinterCE to try again.

SetReportLevel
This Write-Only property sets error level of errors reported to user with MsgBox() error report by
PrinterCE.

MFC Syntax: PrinterCE1.SetSetReportLevel(long value);


C++ Syntax: PrinterCE1.put_SetReportLevel(long value);
eVB Syntax: PrinterCE1.SetReportLevel =value

Parameters

value - Integer that specifies four available error levels

Constant Setting Description


0
vbReportErrors All errors are reported to user
(default)
No errors are reported to user by
PrinterCE... it is up to app to report
vbNoReportErrors 1 errors. However, if user presses Cancel
during print they will see "Are you sure"
prompt.
User cancel is not reported... all true errors
vbReportSeriousErrors 2
are reported
No errors are reported by PrinterCE. If user
vbNoReportErrorsSkipCancel 3 presses Cancel, no "Are you sure" prompt
is given.
Remarks

There are two approaches that a VB program can take while using PrinterCE… first is to set up "On Error"
statements in each sub or function that calls a PrinterCE method or property and use the "On Error"
handler to determine the course of action when an error occurs within PrinterCE. The second approach is
to use occasional calls to StatusCheck to determine if an error has occurred.

When an error occurs within PrinterCE, the severity of the error is determined and PrinterCE "remembers"
this as appropriate. So, for example, if a printer error occurs, the entire printing job must be aborted, so all
calls to PrinterCE will remember that it is aborting and this will be handled gracefully. However, if the error
is an "image file not found" error from a "DrawPicture" method, that current DrawPicture task must be
aborted, but the rest of the print job can continue.

This structure allows the VB program that uses PrinterCE to have a relaxed approach to error handling,
even to the point of ignoring errors completely (although it would be kind to the user to do StatusCheck
calls and display error dialog boxes as needed).

SetupNetPath
NOTE: All calls to SetupNetPath MUST be called BEFORE calling SetupPrinter().

This method sets network path - used if Port=PORT_NETPATH or PORT_IP. For PORT_NETPATH, just
pass the UNC path to PC and named shared printer (see example below). For PORT_IP, make two calls
to SetupNetPath - first one passes NetID string "+1" to specify that next SetupNetPath call will contain IP
address, then call again with IP address (see example).

MFC Syntax: long success=PrinterCE1.SetupNetPath(lBSTR NetString);


C++ Syntax: PrinterCE1.SetupNetPath(BSTR NetString, long* success);
eVB Syntax: success=PrinterCE1.SetupNetPath NetString

Parameters

success - Returns True if successful, False otherwise


NetString - Either a NetID string (see table) or a network path string. To set any specific network string
requires two calls to SetupNetPath. First, SetupNetPath must be called passing one of the NetID string
from the table below to identify what network string will be found in the following call to SetupNetPath.
Then the actual network id string will be sent.

NetID
Value Description
string
Next call to SetupNetPath will pass text string
Network IP
+1 identifying Network IP Printer's IP address (for
Printer Addr
example: "192.168.0.1")
Next call to SetupNetPath will pass text string
Network IP Port
+2 identifying Network IP Printer's Port address (for
Addr
example: "9100")

For example, for an eVB app to specify Host PC to be "JoesPC" with networked printer named "HP995":

PrinterCE1.SetupNetPath "\\JoesPC\HP995"
'Now select printer type and network port type
PrinterCE1.SetupPrinter PR_HP_PCL, PORT_NETPATH, S_DONTCARE

If you wanted to use a network IP printer, you might use the following

PrinterCE1.SetupNetPath "+1" 'Set Network IP printer addr


PrinterCE1.SetupNetPath "192.168.0.20"
PrinterCE1.SetupNetPath "+2" 'Set Network IP port addr
PrinterCE1.SetupNetPath "9101"
'Now select printer type and network port type
PrinterCE1.SetupPrinter PR_HP_PCL, PORT_IP, S_DONTCARE

SetupPrinter
This method sets the main printer settings

MFC Syntax: long success=PrinterCE1.SetupPrinter(long Printer,long Port, long Baudrate);


C++ Syntax: PrinterCE1.SetupPrinter(long Printer,long Port, long Baudrate,long* success);
eVB Syntax: success=PrinterCE1.SetupPrinter Printer, Port, Baudrate

Parameters

success - Returns True if successful, False otherwise


Printer - One of the following printer selections:

Constant Value Description


PR_CANONBJ 0 Canon BubbleJet compatible printers (360 dpi)
PR_CITIZEN_PD04 1 Citizen PD-04, PD-24
PR_CITIZEN_PN60 2 Citizen PN60i
PR_EPSON_ESCP2 3 Epson ESC/P 2 compatible printers
PR_EPSON_STYLUS 4 Epson Stylus compatible printers
PR_HP_PCL 5 HP PCL compatible - includes DeskJet and LaserJet
PR_PENTAX_200 6 Pentax PocketJet 3 and PocketJet 200
PR_PENTAX_300 7 Pentax PocketJet 3 Plus and PocketJet II
PR_SEIKO3445 8 Seiko DPU-3445
Generic Epson compatible 180DPI 24-pin printers
PR_GENERIC24_180 9
(LQ/ESC)
Generic Epson compatible 360DPI 24-pin printers
PR_GENERIC24_360 10
(LQ/ESC)
Generic Epson compatible 203DPI 24-pin printers
PR_GENERIC24_203 11
(LQ/ESC)
PR_EXTECH_2 12 Extech 2" Thermal
PR_EXTECH_3 13 Extech 3" Thermal
PR_ONEIL 14 O'Neil MicroFlash Thermal
PR_DYMOCOSTAR 15 DymoCoStar label printers
PR_SEIKOLABELWRITER 16 Seiko LabelWriter printers
PR_EXTECH_4 17 Extech 4" Thermal
PR_SIPIX 18 SiPix A6 printer
PR_CITIZEN_203 19 Citizen 203DPI printers
PR_ZEBRA 20 Zebra QL, Cameo and Encore
PR_BROTHER 21 Brother MPrint
PR_CANONBJ300 22 Canon BubbleJet 300 dpi
PR_CITIZEN_PD22 23 Citizen PD-22
PR_PP50 25 IPC PP-50
PR_CITIZEN_CMP10 26 Citizen CMP-10
PR_OMNI 27 OMNIPrint 6240 and 6400
PR_SEIKO_L465 28 Seiko MPU-L465
PR_SPRINT 29 CUSTOM s'print
PR_FUJITSU 30 Fujitsu FTP-628WSL110
PR_EPSON_TM_P60 31 Epson TM-P60
PR_INTERMEC 32 Intermec PB/PW/68/78 Thermal
Intermec PB3/PB2
PR_INTERMECPB 49
Note: For PB42/PB50 use PR_INTERMEC
PR_ABLE_AP1300 33 Able Systems Ap1300
PR_AXIOHM_A631 34 Axiohm A631
PR_ELTRADE 35 Eltrade Mobilife
PR_PP55 36 IPC PP-55
PR_CANONBJ600 37 Canon PIXMA iP90, i80, i70
PR_TALLY_MTP4 38 TallyGenicom MTP4 4" thermal printer
PR_TALLY_MIP360 39 TallyGenicom MIP360 rugged 24-pin dot matrix printer
PR_GEBE 40 GeBE Flash 4" Thermal
PR_SATO 41 SATO MB200i
PR_POCKETSPECTRUM 42 Pocket Spectrum
PR_PANASONIC_JTH200PR 43 Panasonic JTH200PR
PR_NOMAD 46 Peripheron Nomad
PR_PENTAXRUGGEDJET 47 Pentax RuggedJet 3 and RuggedJet 4

Port - One of the following printer port selections:

Constant Value Description


PORT_COM1 0 Com1: serial port
PORT_COM2 1 Com2: serial port
PORT_LPT 2 LPT: parallel port
PORT_IR 3 IR Infrared port
PORT_COM3 4 Com3: serial port
PORT_COM4 5 Com4: serial port
PORT_COM5 6 Com5: serial port
PORT_COM6 7 Com6: serial port
PORT_TOFILE 8 Print to file "\OUTPUT.PRN"
PORT_NETPATH 9 Print to shared printer on a networked host PC
PORT_IP 10 Print to network IP printer - a printer with its own IP address
PORT_SOCKETCOM 11 Socket PNC Bluetooth card support
PORT_COM7 13 Com7: serial port
PORT_COM8 14 Com8: serial port
PORT_COMPAQ 15 Compaq Bluetooth iPAQ or sleeve
PORT_IPAQ 15 Bluetooth iPAQ or sleeve
PORT_WIDCOMM 16 Device using WIDCOMM Bluetooth stack
PORT_COM9 17 Com9: serial port
PORT_COM0 19 Com0: serial port
Special for WIDCOMM, HP iPAQ Bluetooth devices that pop up
PORT_BTQUIKPRINT 18 "Bluetooth Browser" to find/select BT printer at print time: using this flag
bypasses the BT browser and uses most recent selected BT printer. To
let user discover and select BT printer, use PORT_COMPAQ,
PORT_IPAQ, PORT_WIDCOMM

Baudrate - One of the following baudrate selections (can use S_DONTCARE or any selection for
PORT_LPT or PORT_NETWORK port selections)::

Constant Value Description


S_DONTCARE 0 Use for LPT or Network printer ports
S_4800 0 4800 baud
S_9600 1 9600 baud
S_19200 2 19200 baud
S_38400 3 38400 baud
S_57600 4 57600 baud
S_115200 5 115200 baud

SetupPaper
This method sets the main paper-selection settings

MFC Syntax: long success=PrinterCE1.SetupPaper(long PaperSize,long Orientation,


float PaperWidth,float PaperHeight,float LeftMgn, float TopMgn,float RightMgn,float BottomMgn);

C++ Syntax: PrinterCE1.SetupPaper(long PaperSize,long Orientation, float PaperWidth,float


PaperHeight,float LeftMgn, float TopMgn,float RightMgn,float BottomMgn,long* success);

eVB Syntax: success=PrinterCE1.SetupPaper (PaperSize, Orientation, PaperWidth, PaperHeight,


LeftMgn, TopMgn, RightMgn, BottomMgn)

Parameters

success - Returns True if successful, False otherwise


PaperSize - One of the following paper-size selections:

Constant Value Description


vbLetter 1 Letter sized paper
vbA4 2 A4 paper
vbB5 3 B5 paper
vbLegal 4 Legal-sized paper
Custom-sized paper (see PaperWidth &
vbCustom 5
PaperHeight parameters)

Orientation - Print orientation

Constant Value Description


vbPortrait 1 Portrait mode
vbLandscape 2 Landscape mode

PaperWidth, PaperHeight - Paper width and height used if PaperSize=vbCustom (in ScaleMode units).
Maximum values: 22 inches, 56 cm, 32000 twips - note that actual paper width settings depend on printer
selection and other factors.
LeftMgn, TopMgn, RightMgn, BottomMgn - Margins used for printed page (in ScaleMode units)

SetupPrinterOther
This method sets a variety of "other" printing options

MFC Syntax: long success=PrinterCE1.SetupPrinterOther(long FFSetting,float


FFScroll, long Density, long Handshake, longBitFlags, long Compressed, long Dither, long Draft
Mode);
C++ Syntax: PrinterCE1.SetupPrinterOther(long FFSetting,float
FFScroll, long Density, long Handshake, long BitFlags, longCompressed, long Dither, long Draft
Mode,long* success);
eVB Syntax: success=PrinterCE1.SetupPrinterOther (FFSetting, FFScroll, Density, Handshake,
BitFlags, Compressed, Dither, DraftMode)

Parameters

success - Returns True if successful, False otherwise


FFSetting- One of the following FormFeed selections:

Constant Value Description


FFEED_NORMAL 0 Printer sends formfeed command to printer at end of each page.
FFEED_PAPERHT 1 PrinterCE scrolls printer to selected paper height.
PrinterCE will scroll paper by "FFScroll" distance from last
FFEED_SCROLL 2
printed portion of page.

FFScroll - Distance (in ScaleMode units) to scroll if FFSetting=FFEED_SCROLL

Density - Darkness/Lightness setting for print density.

Constant Value Description


DENSITY_EXTRALIGHT 0 Lightest printing
DENSITY_LIGHTER 1 Medium light printing
DENSITY_NORMAL 2 Normal printing density
DENSITY_DARKER 3 Darker printing
DENSITY_EXTRADARK 4 Darkest printing

Handshake - Valid only for serial port selections (COM1 or COM2) - Defines serial port handshake:

Constant Value Description


SOFTWARE_HANDSHAKE 0 Uses Xon/Xoff
HARDWARE_HANDSHAKE 1 Uses hardware control lines
NO_HANDSHAKE 2 No handshaking of serial port.

BitFlags - Miscellaneous bit settings (OR these together):

BITFLAG_ADJUST_IR (0x01) - Forces IR (infrared) buffer size to 2040 bytes for Canon BJC printers
and to 64 bytes for all other printers... this fixes IR hardware incompatibilities in a few printers.
BITFLAG_ALTERNATE_IR (0x02) - IR Adjust - There are a few Windows CE devices that have
trouble printing through the infrared port to specific printers due to problems in the infrared port driver
of the device. If your device "hangs" (stops working) when trying to establish infrared connection, try
enabling IR Adjust. Do NOT check this item unless necessary, because it may result in significantly
slower printing speeds:
BITFLAG_COLOR (0x04) - Color - enables color printing for HP PCL, Canon BJC and Epson printer
selections.
BITFLAG_CMYONLY (0x08) - CMY 3-Color Printing - for color printers that do not have black ink.
BITFLAG_SINGLETHREAD (0x40) - PrinterCE normally uses two threads (separate processes) for
printing. Selecting BITFLAG_SINGLETHREAD forces PrinterCE to use one thread.

Compressed - Select data compression mode for printing:

Constant Value Description


COMPRESSED_OFF 0 No compression techniques used (slower printing speed).
COMPRESSED_ON 1 Use any known compression

Dither - Select Dither or Diffusion technique for image conversion :

Constant Value Description


DITHER_OFF 0 Use color diffusion
DITHER_ON 1 Use dithering

DraftMode - Select High Quality vs Draft mode printing (if available)

Constant Value Description


DRAFTMODE_OFF 0 Use highest quality printing
DRAFTMODE_ON 1 Use lower quality but faster printing if available

StatusCheck
This READ-ONLY property returns the current status of PrinterCE.

MFC Syntax: long value=PrinterCE1.GetStatusCheck();


C++ Syntax: PrinterCE1.get_StatusCheck(long * value);
eVB Syntax: value = PrinterCE1.StatusCheck

Returns

value - Integer that specifies four possible status values

Constant Setting Description


vbNoError 0 No error to report
vbUserCancel 1 User cancelled print job
Error aborted the last print operation (but
vbAbortOperation 2
the print job is still viable).
vbAbortPrint 3 Error aborted the print job

Remarks

The AbortOperation status is momentary… if a "DrawPicture" method cannot find the specified image file,
that operation is aborted and a call to StatusCheck that follows the DrawPicture method will return
vbAbortOperation. However, if a successful DrawText operation immediately follows the aborted
DrawPicture call, a call to StatusCheck after DrawText will return vbNoError..
Most apps actually only need to call StatusCheck for checking PrinterCE errors in two places:

- Right after SelectPrinter call - because this is the most common place the user might Cancel or a printer
connection error might occur (such as trying to establish an Infrared connection with no IR printer in
range).

- Right after call to EndDoc (and NewPage if you are printing multiple pages). This lets you determine if
an error was found between SelectPrinter and end of printing the page. If a vbAbortPrint error occurs after
SelectPrinter and before EndDoc, all PrinterCE functions will simply see the error condition and
immediately return until EndDoc, which resets the error condition and prepares PrinterCE to try again.

TextX
This property returns and sets the current X coordinate for text positioning.

MFC Syntax: float value =PrinterCE1.GetTextX();


PrinterCE1.SetTextX(float value);
C++ Syntax: PrinterCE1.get_TextX(float * value);
PrinterCE1.put_TextX(float value);
eVB Syntax: PrinterCE1. TextX [=value]

Parameters

value - Numeric value for the X coordinate. The next DrawText method call will use this coordinate to
position its text (unless DrawText overrides it with an X coordinate in the method). The TextX value is in
the current ScaleMode units. Actual position of the text is impacted by the JustifyHoriz/JustifyVert and
Rotation property settings. TextX is measured from the Left margin setting.

Remarks

TextX and TextY are automatically adjusted after every DrawText call to move to the next line of text. This
allows for automatic printing of multiple lines of text. The amount moved is dependent on the FontSize
(point size) of the text. The direction of movement is dependent on the Rotation property setting

TextY
This property returns and sets the current Y coordinate for text positioning.

MFC Syntax: float value =PrinterCE1.GetTextY();


PrinterCE1.SetTextY(float value);
C++ Syntax: PrinterCE1.get_TextY(float * value);
PrinterCE1.put_TextY(float value);
eVB Syntax: PrinterCE1. TextY [=value]

Parameters

value - Numeric value for the Y coordinate. The next DrawText method call will use this coordinate to
position its text (unless DrawText overrides it with a Y coordinate in the method). The TextY value is in
the current ScaleMode units. Actual position of the text is impacted by the JustifyHoriz/JustifyVert and
Rotation property settings. TextY is measured from the Top margin setting.

Remarks

TextX and TextY are automatically adjusted after every DrawText call to move to the next line of text. This
allows for automatic printing of multiple lines of text. The amount moved is dependent on the FontSize
(point size) of the text. The direction of movement is dependent on the Rotation property setting

S-ar putea să vă placă și