Solved

How do you make an html editor like this?

Posted on 2006-07-05
3
259 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
This guide will walk you through the essential considerations and tech stack for building scalable websites. Know how to grow your business the smart way!
The purpose of this video is to demonstrate how to automatically show related posts at the bottom of a blog post in WordPress. This will be demonstrated using a Windows 8 PC. Plugin “Yet Another Related Posts Plugin” will be used. Go to your…
The purpose of this video is to demonstrate how to update a WordPress Site’s version. WordPress releases new versions of its software frequently and it is important to update frequently in order to keep your site secure, and to get new WordPress…

867 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