|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Announcements
Want a new Job?
Chapters
Services
Feature Zones
|
IntroductionThe The toolstrip of
The context menu of
Using the CodeThis control should be used as any other user control - just drag-drop in a designer, or create a new instance using a code editor. The only thing you need to do is to add a reference to the DLL-file of the control or the whole project in your project's references and add a // Include RicherTextBox namespace to be able to access the control's
// properties and methods
using RicherTextBox;
Without any other code, the control will became available in its full capabilities. If you want to enable or disable some functionality, it can be done in design time using the properties in Here are some examples of hiding items in the toolstrip using code. Let's assume that the control is implemented in a form and its name is set to Hiding a group of tools: //
// To hide the group of buttons for text alignment using the properties
//
richerTextBox1.GroupAlignmentVisible = false;
//
// To hide the group of buttons for text alignment using the methods
//
richerTextBox1.HideToolstripItemsByGroup
(RicherTextBox.RicherTextBoxToolStripGroups.Alignment, false);
The method public void HideToolstripItemsByGroup
(RicherTextBoxToolStripGroups group, bool visible)
... where public enum RicherTextBoxToolStripGroups
{
SaveAndLoad = 0x1,
FontNameAndSize = 0x2,
BoldUnderlineItalic = 0x4,
Alignment = 0x8,
FontColor = 0x10,
IndentationAndBullets = 0x20,
Insert = 0x40,
Zoom = 0x80
}
The values in // Hiding more than one group of tools using a combination of enumerable values
// as a parameter
richerTextBox1.HideToolstripItemsByGroup(
RicherTextBoxToolStripGroups.Alignment |
RicherTextBoxToolStripGroups.BoldUnderlineItalic,
false);
This is what the control looks like after executing this code:
As you can see, the alignment buttons and the bold, italic, underline buttons are now hidden. Using the Methods for Accessing Functionality (Examples)Let's say you want to toggle the bold parameter of the selected text from the code, it is done in a very simple way: // Toggling Bold on the selected text
richerTextBox1.ToggleBold();
Setting the size of the used font: // Setting the font size
richerTextBox1.SetFontSize(8.25f);
The same is used for all of the formatting functionality of the control. If you don't want the save and load buttons visible (or, even if they're visible), you will probably want to access the text which the user has typed in the control. Two properties are supplied for this purpose:
Both properties can be set and read, and the // Setting the text
richTextBox1.Text = "This is an example of setting the text in a RicherTextBox";
// Now, an example of setting the Rtf property to an invalid value:
// The value "Test" is an invalid rich-text format string, but the RicherTextBox
// control will simply read it as plain-text instead of throwing exceptions
richTextBox1.Rtf = "Test";
Searching and ReplacingAll that you need is to show (or, not hide) the toolstrip for finding. All functionality of searching and replacing is integrated in the control.
History
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||