V.2.9
ctlUniRichTextBoxXP

Unicode Rich Textbox, compatible with RichEdit version 1.0, 2.0, 3.0 and 4.1.
>>Common properties

Some Properties/Methods:
Alignment The text alignment on the entire text content
AutoURLDetect If automatic URL detection is enabled, the rich edit control scans any modified text to determine whether the text matches the format of a URL. The control detects URLs that begin with the following prefixes:

http: file: mailto: ftp: https: gopher: nntp: prospero: telnet: news: wais:

The control highlights the URL string by underlining it and setting the text color.

Note: When automatic URL detection is enabled, the rich edit control removes the Link effect from modified text that does not have a URL format recognized by the control. If your application uses the Link effect to mark other types of text, do not enable automatic URL detection.

A rich edit control sends an event notification when it receives various messages while the mouse pointer is over text that has the Link effect
BeginUpdate, EndUpdate permits you to start a long-time update on the control (for example by applying a style to parts of text) without sending out many and many events. So it is fast!
BlockAutoCopy / BlockAutoCut / BlockAutoPaste / BlockAutoUndo The Windows rich text box automatically intercepts some predefined hotkeys so it is able for example to Paste a text if you press the CTRL+V key.

Enable these properties if you need to write customized Copy/Cut/Paste/Undo functions.
CanPaste, CanCopy, CanUndo, CanRedo Notifies if the control can make some actions from Undo, Copy, Paste or Redo
CurrentLine Gets/Sets the current line
Cut, Copy, Paste, PasteSpecial, Undo, Redo, Delete Permits you to make some actions on the control
EmptyUndo Empties the undo buffer
EnableNotifications / DisableNotifications Permits you to enable / disable notification events on the rich text.

Notification events include: selection change, drop files, scroll, text change, etc...
FileName Returns or sets the filename of the file loaded into the RichTextBox control
Find Search the text content for a certain string. Returns the index of the found string, -1 if the string cannot be found.
The iOptions parameter can be a combination of the
eCtlRichTextBox_FindOptions enum values
FindReplaceAll Find and Replaces all occurences of a string into the text of the control
FindSelect Search the text content for a certain string and select it. Returns the index of the found string, -1 if the string cannot be found.
The iOptions parameter can be a combination of the
eCtlRichTextBox_FindOptions enum values
Font Gets/Sets the font associated to the object
GetCharFromPos Returns the character pointed by given (mouse) coordinates
GetContents / SetContents Gets / Sets the control contents (text or RTF) for the selection or the entire text
GetContentsUTF8 / GetContentsUTF7 Gets the control contents using a specified encoding
GetCurrentSelType Returns the current selection type (text, object, etc...)
GetFirstVisibleLine Returns the first visible line in the current view
GetFormatRange / SetFormatRange This method gets / sets many attributes on the selected text / word in a time

Note:
Colors parameters (lForeColor, lBackColor) can be set (or returned by the control) equal to -1&; in this case colors are automatic (CFE_AUTOCOLOR = vbWindowText / CFE_AUTOBACKCOLOR = vbWindowBackground)
GetLineFirstCharIndex Gets the index of the first char of a certain line
GetLineFromCharIndex Returns the line number from the passed character index
GetLineLength Returns the number of chars in a certain line
GetLinesCount Returns the number of lines of text
GetParagraphLineSpacing, SetParagraphLineSpacing, GetParagraphSpacing, SetParagraphSpacing Gets / Sets the current paragraph spacing
GetParagraphOffsets / SetParagraphOffsets Gets / Sets the paragraph offsets (see also SelRightIndent, SelIndent, SelHangingIndent)
GetPosFromChar Returns the (X,Y) position from the specified char index
GetScrollPos / SetScrollPos gets/sets the current scrolling position
GetSelection / SetSelection Gets/Sets the current selection range (start and end indexes)
GetZoom, SetZoom, ZoomFactor Sets / Gets the zoom on the control contents
HideSelection Permits you to maintain visible the text selection also when the control has no focus (set HideSelection = False)
IsInIME You can use this property for knowing if the KeyPress, KeyDown and KeyUp events have been raised by the active IME window associated to your control. By using this property in the KeyPress event you can avoid the IME text. See here.
IsStarted Returns true if the control has been started (when the Unicode window has been created)
LoadFile Loads an .rtf file or text file into a RichTextBox control (also Unicode or UTF8)
Locked Returns or sets a value indicating whether a control can be edited
ManualStart Permits you to start the control manually.
This method is useful when using this control into another usercontrol to prevent bad iterations. See this
page.
MaxLength The maximum number of chars that the control can handle.
The default value is 0& and represents 32,767 characters
Modified This flag can be used by the user to set or get the modified control state
MultiLine Is the control multiline? Yes for default
NoIME Disable the IME input of this control
OnlyBottomBorder Permits you to display only the bottom border of the control
OnlyNumbers Permits you to insert only numbers on the text (this should work only for single-line RichEdit controls)
PasswordChar If this property is set the text field works like a password field. Every characher is displayed using this char so you cannot see contents
RaiseChange Permits you to turn off the change event
RaiseChangeEvent, RaiseSelChangeEvent Enables / Disabled the Change and SelChange events
RedoType Returns the type of the Redo action that will be made when you execute a "Redo"
RequestResizeEvent Gets/Sets if enabling the RequestResize event (False for default)
RichEditVersion Returs the version of the RichEdi control currently used by the system:

Many features are not supported by the version 1.0 so I suggest you to check the RichEdit version and propose the user to install this file if needed:
http://www.hexagora.com/download/support/richupd.exe (update for version 3.0)

The original specification for rich edit controls is Rich Edit 1.0; the current specification is Rich Edit 3.0. Each version of rich edit is a superset of the preceding one, except that only Asian builds of Rich Edit 1.0 have a vertical text option. Before creating a rich edit control, you should call the LoadLibrary function to verify which version of Rich Edit is installed. The following table shows which DLL corresponds with which version of rich edit. Note that the name of the file did not change from version 2.0 to version 3.0. This allows version 2.0 to be upgraded to version 3.0 without breaking existing code.

Rich Edit version DLL
1.0 Riched32.dll (Win95)
2.0 Riched20.dll (Win98/WinNT4)
3.0 Riched20.dll (WinMe/Win2K/WinXP)
4.1 Msftedit.dll (WinXP SP1+)

Windows NT/Windows 2000

Microsoft® Windows NT® version 4.0 includes Rich Edit 1.0 and 2.0. Microsoft Windows® 2000 includes Rich Edit 3.0 with a Rich Edit 1.0 emulator.

Windows 98

Windows 98 includes Rich Edit 1.0 and 2.0.

Windows 95

Windows 95 includes only Rich Edit 1.0. However, Riched20.dll is compatible with Windows 95 and may be installed if an application that uses Rich Edit 2.0 has been installed.
RightMargin, LeftMargin Gets / Sets the margin of the control and the inner text
RightToLeft For bidirectional input on the entire control
RightToLeft For bidirectional input on the entire control
SaveFile Saves the contents of a RichTextBox control to a file (RTF, Unicode or Ansi)
ScrollBars Set the scrollbars on the control
ScrollCaret Scrolls the caret into view in an edit control
SelBold, SelItalic, SelUnderline, SelStrikeThru, SelColor, SelBackColor, SelFontName, SelFontSize, SelProtected, SelLink, SelUnderlineType, SelAlignment, SelBullet, SelRightIndent, SelIndent, SelHangingIndent, SelCharOffset (for subscript and superscript), SelParaRTL, SelAnimation, SelRevAuthor, SelStyle, SelSpacing Return or set font styles of the currently selected text in a RichTextBox control. The font styles include the following formats: Bold, Italic, Strikethru, and Underline. Not available at design time

Note (for SelColor and SelBackColor):
The color can be set (or returned) equal to -1&; in this case colors are automatic (CFE_AUTOCOLOR = vbWindowText / CFE_AUTOBACKCOLOR = vbWindowBackground)
SelLength Returns or sets the number of characters selected (RUNTIME)
SelRTF Returns or sets the text (in .rtf format) in the current selection of a RichTextBox control. Not available at design time
SelStart Returns or sets the starting point of text selected; indicates the position of the insertion point if no text is selected (RUNTIME)
SelText Returns or sets the string containing the currently selected text; consists of a zero-length string ("") if no characters are selected
SelectAll / SelectNone Selects all or no text
SelfIME Has the control a self-managed IME?
SetFocus Sets the focus on this window
TabSize Specifies how many spaces a Tabulation char is
Text Returns or sets the text contained in an object.
Unicode or Ansi based on the system and on the installed RichEdit version
TextLength Returns the length of the internal text
TextMode Sets the text mode (Text or RichText)
TextRTF Returns or sets the text of a RichTextBox control, including all .rtf code
TrapTabKey Permits you to trap the tab character (so the control can insert this char into its contents without passing the focus to another control)
UndoType Returns the type of the Undo action that will be made when you'll execute "Undo"
VerticalLayout Enabled only on Asian versions of Windows
ViewMode Gets / Sets the control style (Standard, WordWrap or WYSIWYG)
hWnd Return the handle of the internal RichEdit Unicode window
hWndUserControl Returns the handle of the Usercontrol windows (this is the handle of the window that contains the other RichEdit window)
z__SaveCallBack, z__LoadCallBack Reserved and must not be used
Events:
AlignRTL, AlignLTR Raised when the text alignment changes
IMEComposition see here
LinkOver This event occurs when the mouse or the caret is over a link (a portion of text marked with the Link attribute (SelLink))
ModifyProtected This event is raised evetytime a user tries to modify a part of text marked as protected, with the SelProtected property. You can avoid the change by returning bDoIt=False
MouseWheel Raised when someone scrolls the mouse wheel
RequestResize Raised when the content of the control is bigger or smaller that the control size. This event works only if you enable it using the RequestResizeEvent property (default is false)
SelChange This event is raised everytime the caret changes its position
Change Sent when the internal text changes. This event is raised if the RaiseChangeEvent property is enabled (default is true)
Update Sent when an edit control is about to redraw itself. This notification message is sent after the control has formatted the text, but before it displays the text. This makes it possible to resize the edit control window, if necessary.
Raised if the property
RaiseUpdateEvent is enabled (default is false).
Paste Raised when some text is being pasted to the control.
You can avoid this operation by returning "false" to the bCancel parameter.
Copy / Cut Raised when someone copies or cuts text
MsgFilter Permits you to completely manage every RichEdit message changing it if you want.
You need to enable the "RaiseMsgFilterEvent" flag in order to receive this event.
VScroll, HScroll Raised when scrollbars scroll
(ctlUniRichTextBoxXP control with Paragraph alignment, background color, bullets and Unicode Text)
(the ctlUniRichTextBoxXP control supports Unicode text at Design time)
http://www.hexagora.com
Wed, 17 Feb 2010 14:12:05 UT
Copyright 2003-10 by Lorenzi Davide