Method | Description | |
---|---|---|
AppendRtf ( string _rtf ) : void |
Assumes the string passed as a paramter is valid RTF text and attempts to append it as RTF to the content of the control.
|
|
AppendTextAsRtf ( string _text ) : void |
Appends the text using the current font, text, and highlight colors.
|
|
AppendTextAsRtf ( string _text, |
Appends the text using the given font, and current text and highlight colors.
|
|
AppendTextAsRtf ( string _text, |
Appends the text using the given font and text color, and the current highlight color.
|
|
AppendTextAsRtf ( string _text, |
Appends the text using the given font, text, and highlight colors. Simply moves the caret to the end of the RichTextBox's text and makes a call to insert.
|
|
ExRichTextBox ( ) : System |
Initializes the text colors, creates dictionaries for RTF colors and font families, and stores the horizontal and vertical resolution of the RichTextBox's graphics context.
|
|
ExRichTextBox ( RtfColor _textColor ) : System |
Calls the default constructor then sets the text color.
|
|
ExRichTextBox ( RtfColor _textColor, RtfColor _highlightColor ) : System |
Calls the default constructor then sets te text and highlight colors.
|
|
InsertImage ( Image _image ) : void |
Inserts an image into the RichTextBox. The image is wrapped in a Windows Format Metafile, because although Microsoft discourages the use of a WMF, the RichTextBox (and even MS Word), wraps an image in a WMF before inserting the image into a document. The WMF is attached in HEX format (a string of HEX numbers). The RTF Specification v1.6 says that you should be able to insert bitmaps, .jpegs, .gifs, .pngs, and Enhanced Metafiles (.emf) directly into an RTF document without the WMF wrapper. This works fine with MS Word, however, when you don't wrap images in a WMF, WordPad and RichTextBoxes simply ignore them. Both use the riched20.dll or msfted.dll. NOTE: The image is inserted wherever the caret is at the time of the call, and if any text is selected, that text is replaced. |
|
InsertRtf ( string _rtf ) : void |
Assumes that the string passed as a parameter is valid RTF text and attempts to insert it as RTF into the content of the control. NOTE: The text is inserted wherever the caret is at the time of the call, and if any text is selected, that text is replaced. |
|
InsertTextAsRtf ( string _text ) : void |
Inserts the text using the current font, text, and highlight colors.
|
|
InsertTextAsRtf ( string _text, |
Inserts the text using the given font, and current text and highlight colors.
|
|
InsertTextAsRtf ( string _text, |
Inserts the text using the given font and text color, and the current highlight color.
|
|
InsertTextAsRtf ( string _text, |
Inserts the text using the given font, text, and highlight colors. The text is wrapped in RTF codes so that the specified formatting is kept. You can only assign valid RTF to the RichTextBox.Rtf property, else an exception is thrown. The RTF string should follow this format ... {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{[FONTS]}{\colortbl ;[COLORS]}} \viewkind4\uc1\pard\cf1\f0\fs20 [DOCUMENT AREA] } NOTE: The text is inserted wherever the caret is at the time of the call, and if any text is selected, that text is replaced. |
Method | Description | |
---|---|---|
GdipEmfToWmfBits ( |
||
GetColorTable ( RtfColor _textColor, RtfColor _backColor ) : string |
Creates a font table from the RtfColor structure. When an Insert or Append operation is performed, _textColor and _backColor are either specified or the default is used. In any case, on any Insert or Append, only three colors are used. The default color of the RichTextBox (signified by a semicolon (;) without a definition), is always the first color (index 0) in the color table. The second color is always the text color, and the third is always the highlight color (color behind the text). The color table should have the form ... {\colortbl ;[TEXT_COLOR];[HIGHLIGHT_COLOR];}
|
|
GetDocumentArea ( string _text, |
Creates the Document Area of the RTF being inserted. The document area (in this case) consists of the text being added as RTF and all the formatting specified in the Font object passed in. This should have the form ... \viewkind4\uc1\pard\cf1\f0\fs20 [DOCUMENT AREA] }
|
|
GetFontTable ( |
Creates a font table from a font object. When an Insert or Append operation is performed a font is either specified or the default font is used. In any case, on any Insert or Append, only one font is used, thus the font table will always contain a single font. The font table should have the form ... {\fonttbl{\f0\[FAMILY]\fcharset0 [FONT_NAME];}
|
|
GetImagePrefix ( Image _image ) : string |
Creates the RTF control string that describes the image being inserted. This description (in this case) specifies that the image is an MM_ANISOTROPIC metafile, meaning that both X and Y axes can be scaled independently. The control string also gives the images current dimensions, and its target dimensions, so if you want to control the size of the image being inserted, this would be the place to do it. The prefix should have the form ... {\pict\wmetafile8\picw[A]\pich[B]\picwgoal[C]\pichgoal[D] where ... A = current width of the metafile in hundredths of millimeters (0.01mm) = Image Width in Inches * Number of (0.01mm) per inch = (Image Width in Pixels / Graphics Context's Horizontal Resolution) * 2540 = (Image Width in Pixels / Graphics.DpiX) * 2540 B = current height of the metafile in hundredths of millimeters (0.01mm) = Image Height in Inches * Number of (0.01mm) per inch = (Image Height in Pixels / Graphics Context's Vertical Resolution) * 2540 = (Image Height in Pixels / Graphics.DpiX) * 2540 C = target width of the metafile in twips = Image Width in Inches * Number of twips per inch = (Image Width in Pixels / Graphics Context's Horizontal Resolution) * 1440 = (Image Width in Pixels / Graphics.DpiX) * 1440 D = target height of the metafile in twips = Image Height in Inches * Number of twips per inch = (Image Height in Pixels / Graphics Context's Horizontal Resolution) * 1440 = (Image Height in Pixels / Graphics.DpiX) * 1440 The Graphics Context's resolution is simply the current resolution at which windows is being displayed. Normally it's 96 dpi, but instead of assuming I just added the code. According to Ken Howe at pbdr.com, "Twips are screen-independent units used to ensure that the placement and proportion of screen elements in your screen application are the same on all display systems." Units Used ---------- 1 Twip = 1/20 Point 1 Point = 1/72 Inch 1 Twip = 1/1440 Inch 1 Inch = 2.54 cm 1 Inch = 25.4 mm 1 Inch = 2540 (0.01)mm |
|
GetRtfImage ( Image _image ) : string |
Wraps the image in an Enhanced Metafile by drawing the image onto the graphics context, then converts the Enhanced Metafile to a Windows Metafile, and finally appends the bits of the Windows Metafile in HEX to a string and returns the string.
|
|
RemoveBadChars ( string _originalRtf ) : string |
Called by overrided RichTextBox.Rtf accessor. Removes the null character from the RTF. This is residue from developing the control for a specific instant messaging protocol and can be ommitted.
|
public AppendTextAsRtf ( string _text ) : void | ||
_text | string | |
return | void |
public AppendTextAsRtf ( string _text, |
||
_text | string | |
_font | ||
return | void |
public AppendTextAsRtf ( string _text, |
||
_text | string | |
_font | ||
_textColor | RtfColor | |
return | void |
public AppendTextAsRtf ( string _text, |
||
_text | string | |
_font | ||
_textColor | RtfColor | |
_backColor | RtfColor | |
return | void |
public ExRichTextBox ( RtfColor _textColor ) : System | ||
_textColor | RtfColor | |
return | System |
public ExRichTextBox ( RtfColor _textColor, RtfColor _highlightColor ) : System | ||
_textColor | RtfColor | |
_highlightColor | RtfColor | |
return | System |
public InsertTextAsRtf ( string _text ) : void | ||
_text | string | |
return | void |
public InsertTextAsRtf ( string _text, |
||
_text | string | |
_font | ||
return | void |
public InsertTextAsRtf ( string _text, |
||
_text | string | |
_font | ||
_textColor | RtfColor | |
return | void |
public InsertTextAsRtf ( string _text, |
||
_text | string | |
_font | ||
_textColor | RtfColor | |
_backColor | RtfColor | |
return | void |