ComponentOne List 8.0 for ActiveX
UnitsPerInch Property

 

UnitsPerInch Property

Use the UnitsPerInch property to determine the logical resolution of a printer device context.

Syntax

PrintInfo.UnitsPerInch= long

Remarks

Read-only at run time. Not available at design time.

Property applies to PrintInfo object.

You do not need to use this property unless your application uses owner-drawn cells in conjunction with the PrintData or PrintPreview methods.

When creating fonts for use in the OwnerDrawCellPrint event, you can use the value returned by the UnitsPerInch property to calculate the appropriate font size. For example, the following code creates a 10-point bold Tahoma font suitable for printing:

Dim UPI As Long, lfHeight As Long

Dim NewPrinterFont As Long

UPI = TDBGrid1.PrintInfo.UnitsPerInch

lfHeight = -(10 * UPI / 72)

NewPrinterFont = CreateFont(lfHeight, 0, 0, 0, 700, _

    0, 0, 0, 0, 0, 0, 0, 0, "Tahoma")

You can access the UnitsPerInch property anywhere in your application. Typically, this is done in the Form_Load event.

See Also

PrintInfo Object, PrintInfos Collection

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback