Solved

How do you make an html editor like this?

Posted on 2006-07-05
3
287 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

This article provides a case study on how our local youth baseball league deployed a new website, including the platform selection, implementation and benefits to the league.
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 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 add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…

696 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