The new vbAccelerator Site - more VB and .NET Code and Controls
name="sectop">
Source Code
1 ActiveX Controls &nbsp
&nbsp

vbAccelerator RichEdit Control

An implementation of the Microsoft RichEdit control directly from the API for more flexibility and control


vbAccelerator RichEdit Control Demonstration Project

Download Code
VB5 code Download the vbAccelerator RichEdit control only (56kb)
VB5 code Download the vbAccelerator RichEdit demonstration project (requires the control first) (50kb)
VB5 code Download the full vbAccelerator RichEdit control source including demonstration (164kb)

&nbsp Source Code Note &nbsp
&nbsp This OCX is a binary compatible component which works with all other samples. If you compile your own copy of this OCX yourself please make sure you change the name. See disclaimer and license for more details. &nbsp
&nbsp Before you Begin &nbsp
&nbsp All projects require the SSubTmr.DLL component. Make sure you have loaded and registered this before trying any project. &nbsp
&nbsp The control project also requires the Ole Guids and Interface Definitions type library (OleGuids.TLB) when running in the IDE. Make sure you have downloaded and registered this before trying the project. &nbsp
&nbsp
&nbsp

Overview
The vbAccelerator RichEdit control is a project which has been under construction at this site for some time, and here is the first release. This is a highly featured implementation of the RichEdit control (also called the RichText control under VB) which aims to give you the control that VB can't give you in RichEdit implementations.

There are a lot of exciting additions to come for this project over the next few months. Check out the vbAccelerator RoadMap for RichEdit development for more information!

Using RichEdit Controls
Before we begin, its worth pointing out that RichEdit controls have more uses than just for RTF editors. For example, the VB/VBA Object Browser uses a version 2.0 RichEdit to implement a hyperlinked display in the bottom pane:

VB Object Browser with RichEd20.DLL Pane

And Office makes almost exclusive use of RichEdit controls to implement all text boxes in its dialogs, presumably because it is easier to internationalise than the standard Edit control.

Microsoft's RichEdit Control Versions
There are now three versions of the RichEdit control available, depending on the OS version and software that you have. The features have been gradually improving, as shown in the table below:

Version DLL OS Version Notes
1.0 RichEd32.DLL Win95 This is the lowest common denominator version of RichEdit, and is the version that the Microsoft RichText OCX for VB is based on. The code in RichEdit 2 is much improved compared to this version.
2.0 RichEd20.DLL WinNT 4.0, Installed with MS Office RichEdit 2.0 adds font background colour, hyperlink, multi-level Undo and Transparency support. This control is much better at reading Office RTF documents and also has much improved Unicode and asian language support. More Details.
3.0 RichEd20.DLL Win2000. Can also be obtained by installing the Microsoft System Installer (MSI) redistributable (which I recommend!) RichEdit 3.0 adds zoom in/out, more underline styles, paragraph numbering, simple table support, suspend Undo/Redo and further improves the Office/multi-lingual facilities. More Details.
The vbAccelerator implementation will operate as a version 2.0/3.0 RichEdit control (using RichEd20.DLL). However, you can set the control to operate using the more limited RichEdit version 1.0 control (which is implemented in RichEd32.DLL). If you do this the methods and properties related to the new features are still available, but calling them has no effect.

At this point the control has been implemented with version 2.0 feature support. Version 3.0 support will be added once Win2000 has been released and the documentation for this version has been finalised, however, since the control is a direct API implementation you will see it is quite easy to access the new features as shown in the Zoom and Outline samples.

Control Features
  • Supports RichEdit 1.0, 2.0 or 3.0
  • View documents with word-wrap or not as well as in WYSIWYG mode.
  • Set the background colour of any selection in the control
  • Automatic hyperlink detection, and the ability to manually add your own hyperlinks to any portion of text
  • Tile a picture into the background of the RichEdit control.
  • Full control over keyboard accelerators including the Tab key.
  • Hanging indents, line-spacing, paragraph before and after spacing all controllable through code.
  • Multi-level Undo and Redo, with naming for the Undo and Redo items
  • Force control to be Text-only
  • SingleLine and Password support built-in
  • Built-in Printer dialog, and control over margins when printing
  • Insert text or RTF, or get the selection as text or RTF
An article, Coding with the vbAccelerator RichEdit control, is a available to describe the main features and their use.
Development Roadmap
Right now there are a few things the RichEdit control does not support. The control has an exciting development road-map to provide these features over time.
  1. RichEdit Print Preview control.
    This control will allow you to perform an MFC style preview
  2. RichEdit Print Multiplexer control.
    By virtually splitting a printed page into parts and using multiple RichEdit controls, it is possible to support complex header and footer arrangements. This control will make it easy to set up the print out from any RichEdit control.
  3. An Office 97 Style Ruler Bar
    This control will make it easy to see and adjust paragraph tabs and hanging indents for any RichEdit control.
  4. RichEdit OLE Support Package
    The current RichEdit control does not support bitmaps because this requires the control to support the IRichEditOLE interface.

Documentation
Documentation for the vbAccelerator RichEdit control's properties, methods and classes is available as an RTF. This documentation was created with the ActiveX Documenter (which itself uses a variant of the RichEdit control!).

Click here to download/view the vbAccelerator RichEdit control method and event documentation




TopBack to top
Source Code - What We're About!Back to ActiveX Control Source Code
Source Code - What We're About!Back to Source Code

&nbsp

AboutContributeSend FeedbackPrivacy

Copyright 1998-1999, Steve McMahon ( steve@vbaccelerator.com). All Rights Reserved.
Last updated: 15 November 1999