fawad
fawad

Reputation: 177

Rich Text Editing in Windows Forms

I am using this text editor for my windows forms application

This works great and is a wonderful control, however I am trying to accomplish one task: I wanted to insert a custom tag to the underlying html for eg if user clicks on a button on form I want to insert a tag <myTag>value</myTag>" at the cursor's position of text editor.

Can anyone guide me how to achieve this?

Upvotes: 0

Views: 5076

Answers (3)

I am facing the issue: Code Generation for the Property 'Body Background Color' failed. Error was: 'Property Accessor 'BodyBackgroundColor' on object editor 1 threw the following exception 'Input string was not in correct format'.

Upvotes: 0

fawad
fawad

Reputation: 177

Guys, Thanks for responses, following code solves the issue

        IHTMLTxtRange range = doc.selection.createRange() as IHTMLTxtRange;
        range.pasteHTML(string.Format("<span>myTag</span>",range.text));
        range.collapse(false);
        range.select();

Upvotes: 1

AZ_
AZ_

Reputation: 21899

get column and rows of cursor and put your HTML tag there. example if my cursor is blinking some where on the page try to get its X and Y (Rows and Columns).

Upvotes: 0

Related Questions