FormatDC, FormatWidth Properties

Purpose

Returns or sets the information that a RichEdit control uses to format its output for a particular device.

Syntax

RichEdit.FormatDC [= hDC ]

RichEdit.FormatWidth [= width ]

hDC:Handle
width:Long, in twips

Description

The FormatDC property sets the target device to format for. It uses the paper width to format a rich edit control's contents for that device, such as a printer. This is useful for WYSIWYG (what you see is what you get) formatting, in which an application positions text using the printer's font metrics instead of the screen's.

FormatWidth allows you to specify the line width for which a rich edit control formats its text.

Example

Ocx RichEdit rtf = "", 10, 10, 300, 200

rtf.SelText = String( 5, "GFA-BASIC 32 ")

rtf.SelItalic = 1

rtf.SelText = String( 5, "GFA-BASIC 32 ")

rtf.SelBold = 1

rtf.SelText = String( 5, "GFA-BASIC 32 ")

rtf.SelItalic = 0

rtf.SelText = String( 5, "GFA-BASIC 32 ")

Message "Click here' to effect changes"

rtf.FormatDC = Printer.hDC

rtf.FormatWidth = Printer.Width

Do : Sleep : Until Me Is Nothing

See Also

RichEdit, SelPrint

{Created by Sjouke Hamstra; Last updated: 07/10/2014 by James Gaite}