Hello. I'm doing a html editor.
i want a function to the html editor that change the color on the text when I press a button. Example if I write this code in the html editors textbox:
<table><tr><td bgcolor = "abc123">hello</td></tr><table>
And then I press the button would it change the text color like this:
<table><tr><td bgcolor = "abc123">hello</td></tr></table>
What code should I use for that function?
FullBjarne
0
Newbie Poster
Recommended Answers
Jump to PostHi, Use RichTextBox for editor. This control has SelectionColor property to change the color of the Selected Text.
But selecting should be done by you
Jump to PostRich Text Box has KeyDown Event where you have to change the color by ur code when receiving '<' and '>' characters. This change the color when typing
If you want to set the color when press a button, then parse the text first, then apply the color to …
Jump to PostThe above code that i posted only works when type the tags
When you want change the color by pressing button. I am not familiar with Regular Expression, still a try.
Try thisprivate void button1_Click(object sender, EventArgs e) { Regex regex = new Regex(@"(<\b[^>]*>)|(</\b[^>]*>)", RegexOptions.IgnoreCase …
All 12 Replies
selvaganapathy
31
Posting Pro
FullBjarne
0
Newbie Poster
selvaganapathy
31
Posting Pro
FullBjarne
0
Newbie Poster
farooqaaa
48
Enthusiast
selvaganapathy
31
Posting Pro
farooqaaa
48
Enthusiast
selvaganapathy
31
Posting Pro
farooqaaa
commented:
Thanks man. You solved our problem! - farooqaaa
+1
FullBjarne
0
Newbie Poster
FullBjarne
0
Newbie Poster
farooqaaa
48
Enthusiast
Diamonddrake
397
Master Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.