The RTF Control
You can use the Rich Text Box control to enter and edit text. This control provides more advanced formatting features than does the conventional Text Box control. In addition, the Rich Text Box control has a number of properties you can use to apply formatting to any portion of text within the control. Using these properties, you can make text bold or italic (or both), change its color, and create superscripts and subscripts. You can also adjust paragraph formatting by setting left and right indents and hanging indents.
To change the formatting of text, you must first select the text you want to make these changes to, because you can assign character and paragraph formatting only to text that's selected.
- Use as a "bottomless" text box so that a given Office application can read extremely large text files.
- Implement a full-featured text-editing application in any Office application.
Source: MSDN Library.
- The Rich Text Box control has a number of robust features you can use to considerably enhance the functionality within your customized Office applications. Using this control, you can:
- Open and save files in both the RTF and ASCII text formats. You can use the Load File and SaveFile methods of the Rich Text Box control to read and write files directly; you can also use properties of the control, such as Sel RTF and TextRTF, in conjunction with Visual Basic file input/output statements.
- Load the contents of an .rtf file into the Rich Text Box control simply by dragging the file (from the Windows Explorer, for example) or a highlighted portion of a file created in another application (such as Microsoft Word) and then dropping the contents directly onto the control.
- Set the FileName property to load the contents of an .rtf or .txt file into the control.
- Print all or part of the text in a Rich Text Box control by using the Sel Print method. A search of the VFP7 help and Hackers Guide finds that there is no such thing as a "Sel Print"-- it appears to be something from the VB language. Randy Bosma
- Programmatically add embedded objects such as bitmaps and icons to the control at run time by using the OLEObject collection's Add method. At both design time and run time, you can drag and drop any embedded objects—including documents such as Microsoft Excel spreadsheets and Word documents—into the control.
- Employ almost all of the properties, events, and methods used with the standard Text Box control, such as the MaxLength, MultiLine, Scroll Bars, SelLength, SelStart, and Sel Text properties. You can easily adapt applications that already use Text Box controls to make use of Rich Text Box controls. Note that a Rich Text Box control isn't restricted by the 64-character limit that applies to the conventional Text Box control.
There's a problem when the .text property is changed - the .Rtf Text loses formatting. This makes spellchecking extremely difficult to apply to RTF text, unless we use Word automation. Does anyone have a good solution for this? -- Dragan Nedeljkovich
A client of mine, Phil Hawkins, wrote a good article on this subject: See Copying and spell-checking RTF data via the clipboard. Mike Lewis
Rich Text Format (RTF) Specification, version 1.6
There are problems in the current security-aware environment.
I wish I could find a VFP 9 dropable forms compatible Rich Text Box control based on .NET 3.0 or 3.5. Craig Roberts
Contributors: Fernando Alvares
( Topic last updated: 2008.07.31 11:42:24 AM )