|
Using your own controls to invoke the
functionalities of the factory toolbar buttons
.NET Win Html Editor Control is very much flexible for customization. You may choose
not to be bothered with the factory shipped items, rather if you want to use your
own toolbar items, it is very easy to implement that. Please follow the following
steps for doing so.
Step 1: Select the toolbar on the editor and hit the delete button
or simply delete from the context menu.
Step 2: Add your own button anywhere in your windows form. For example,
we will show you how to add a Bold Button.
Step 3: Attach a click event handler for your Bold Button and add the
following snippet within the Click Event Handler method of your Bold Button. (Assume
that, the instance of your editor is named as "htmlEditor1".
htmlEditor1.Operations.Bold();
Step 4: In this way, you can keep on adding more and more buttons
and you can use the reference of all public methods that supports implementing your
own button from the
following URL:
Adding Context Sensibility to your own buttons:
Once you added your own buttons (assume that you placed toolsrtripButton on ToolStrip
Control) , you may want to set the checked status TRUE for your Bold button, Italic
Button, Underline Button etc if the selected or active context is bolded, italic
or underlined etc.
You can easily do that by using the Composite Property SelectionState. This composite property has members for getting the context status of the editor
. For
example, the Bold button's checked status can be set by the following snippet.
toolStripButtonBold.Checked
= htmlEditor1.SelectionState.IsBold;
In this way, you can check the status for Italic button, Underline button, Ordered
List button, Unordered List Button etc. You may also check the active Html element
so that you can check some dialog based insert purpose buttons. For example, you
may want to check an Image Insert Button if the active html element is an image.
The following snippet shows an example for doing these tasks.

|