Solved

How do you make an html editor like this?

Posted on 2006-07-05
3
248 Views
Last Modified: 2013-12-16
Is there any way to have a richtextbox that when you type "<html>" it colors that text only and not the rest of the text?
Please help,
Joseph
0
Comment
Question by:JoeTheCoinMan
  • 2
3 Comments
 
LVL 15

Expert Comment

by:lakshman_ce
ID: 17046462
Find for the tag and color it before loading to your form

Sample code

RichTextBox* richTextBox1 = new RichTextBox();
richTextBox1->Dock = DockStyle::Fill;
richTextBox1->LoadFile(S"C:\\IssuesSystem.rtf",RichTextBoxStreamType::RichText);
richTextBox1->Find(S"<html>", RichTextBoxFinds::MatchCase);
richTextBox1->SelectionColor = Color::Red;
this->Controls->Add(richTextBox1);
0
 

Author Comment

by:JoeTheCoinMan
ID: 17046510
So there is no way to do this as the user types?
0
 
LVL 15

Accepted Solution

by:
lakshman_ce earned 500 total points
ID: 17047882
There is a way but it would be after the completion of <html> tag

1. Handle the RichTextBox_TextChanged event
2. Get the text in the richtextbox
3. Find the string <html> in it
4. change the color

void richTextBox1_TextChanged(Object* /*sender*/, EventArgs* /*e*/) {
{
richTextBox1->Find(S"<html>", RichTextBoxFinds::MatchCase);
richTextBox1->SelectionColor = Color::Red;
}


0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

When deciding to adopt any help desk solutions many factors should be explored before taking decisions. This will change from business to another but in general there are some kind of rule of thumb. Here are some quick tips: Do we need only ticket…
Objective of This Article In 1990’s, when I was a budding software professional, I had a lot of confusion about which stream or technology, I had to choose to build my career. In those days, I had lot of confusion like whether to choose System so…
The purpose of this video is to demonstrate how to make a WordPress Site faster and smaller in size by cleaning up the database. This will be demonstrated using a Windows 8 PC. Plugin WP Optimize will be used. Go to your WordPress login page. T…
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now