Hello, I'm crazy but I want create an editor with c# and
System.Windows. Forms.RichTextB ox.
I have many difficult to create the effect to highlights the text and to
close the tags.
This is my code:
int cursor = richTextBox.Sel ectionStart;
Regex attrs = new Regex(@"<\/?\w+(\s+\w+=""( \w+)"")*>");
MatchCollection matches = attrs.Matches(r ichTextBox.Text );
foreach (Match match in matches)
{
GroupCollection groups = match.Groups;
Group group = groups[0];
CaptureCollecti on captures = group.Captures;
for (int i = 0; i < captures.Count; i++)
{
string word = captures[i].Value;
int index = captures[i].Index;
richTextBox.Sel ect(index, word.Length);
richTextBox.Sel ectionColor = Color.DarkBlue;
richTextBox.Des electAll();
}
Group groupAttrs = groups[2];
CaptureCollecti on capturesAttrs = groupAttrs.Capt ures;
for (int i = 0; i < capturesAttrs.C ount; i++)
{
string word = capturesAttrs[i].Value;
int index = capturesAttrs[i].Index;
richTextBox.Sel ect(index, word.Length);
richTextBox.Sel ectionColor = Color.Green;
richTextBox.Des electAll();
}
}
that color html tag in blue and value of attribute in green
BUT
the effect of flickers is horrible (es. select -> color -> deselect ->
select -> color ..etc...)
Any suggestions? 2 1915
Hello Groide,
What if you use the SelectionStart and SelectionLength properties and make a
good use of the LockWindowUpdat e API to prevent any redrawing until the
re-coloring is done (try without LockWindowUpdat e first, though)?
--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]
"Groide" <gr****@tiscali .it> wrote in message
news:42******** ************@ne ws.tiscali.it.. . Hello, I'm crazy but I want create an editor with c# and System.Windows. Forms.RichTextB ox. I have many difficult to create the effect to highlights the text and to close the tags. This is my code:
int cursor = richTextBox.Sel ectionStart;
Regex attrs = new Regex(@"<\/?\w+(\s+\w+=""( \w+)"")*>");
MatchCollection matches = attrs.Matches(r ichTextBox.Text );
foreach (Match match in matches)
{
GroupCollection groups = match.Groups;
Group group = groups[0];
CaptureCollecti on captures = group.Captures;
for (int i = 0; i < captures.Count; i++)
{
string word = captures[i].Value;
int index = captures[i].Index;
richTextBox.Sel ect(index, word.Length);
richTextBox.Sel ectionColor = Color.DarkBlue;
richTextBox.Des electAll();
}
Group groupAttrs = groups[2];
CaptureCollecti on capturesAttrs = groupAttrs.Capt ures;
for (int i = 0; i < capturesAttrs.C ount; i++)
{
string word = capturesAttrs[i].Value;
int index = capturesAttrs[i].Index;
richTextBox.Sel ect(index, word.Length);
richTextBox.Sel ectionColor = Color.Green;
richTextBox.Des electAll();
}
}
that color html tag in blue and value of attribute in green BUT the effect of flickers is horrible (es. select -> color -> deselect -> select -> color ..etc...)
Any suggestions?
Thanks a lot, i must imprt a dll on my c# project
[DllImport("user 32.dll")]
but the result is perfect.
Groide
"Dmytro Lapshyn [MVP]" <x-****@no-spam-please.hotpop.c om> ha scritto nel
messaggio news:%2******** *******@TK2MSFT NGP15.phx.gbl.. . Hello Groide,
What if you use the SelectionStart and SelectionLength properties and make a good use of the LockWindowUpdat e API to prevent any redrawing until the re-coloring is done (try without LockWindowUpdat e first, though)?
-- Sincerely, Dmytro Lapshyn [Visual Developer - Visual C# MVP]
"Groide" <gr****@tiscali .it> wrote in message news:42******** ************@ne ws.tiscali.it.. . Hello, I'm crazy but I want create an editor with c# and System.Windows. Forms.RichTextB ox. I have many difficult to create the effect to highlights the text and to close the tags. This is my code:
int cursor = richTextBox.Sel ectionStart;
Regex attrs = new Regex(@"<\/?\w+(\s+\w+=""( \w+)"")*>");
MatchCollection matches = attrs.Matches(r ichTextBox.Text );
foreach (Match match in matches)
{
GroupCollection groups = match.Groups;
Group group = groups[0];
CaptureCollecti on captures = group.Captures;
for (int i = 0; i < captures.Count; i++)
{
string word = captures[i].Value;
int index = captures[i].Index;
richTextBox.Sel ect(index, word.Length);
richTextBox.Sel ectionColor = Color.DarkBlue;
richTextBox.Des electAll();
}
Group groupAttrs = groups[2];
CaptureCollecti on capturesAttrs = groupAttrs.Capt ures;
for (int i = 0; i < capturesAttrs.C ount; i++)
{
string word = capturesAttrs[i].Value;
int index = capturesAttrs[i].Index;
richTextBox.Sel ect(index, word.Length);
richTextBox.Sel ectionColor = Color.Green;
richTextBox.Des electAll();
}
}
that color html tag in blue and value of attribute in green BUT the effect of flickers is horrible (es. select -> color -> deselect -> select -> color ..etc...)
Any suggestions? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Ray Tayek |
last post by:
hi, trying to convert some csv files into xsml and pulling a few hairs
out :(. using the files below. a java program will parse the csv and
take care of strange names and notes that line breaks in them.
eventiually i want to generate the xslt from a xml file (all the files
and java code are at http://tayek.com/~ray/spy1/).
the java code (1.4) does the right thing (it just does the
transformation). xmlspy seems really broken when i hit...
|
by: Timo Nentwig |
last post by:
Hi!
Is there an XML editor for linux that features that great grid table
layout of XmlSpy?
Timo
|
by: Mike Kamermans |
last post by:
I hope someone can help me, because what I'm going through at the moment
trying to edit XML documents is enough to make me want to never edit XML
again.
I'm looking for an XML editor that has a few features that you'd expect
in any editor, except nearly none of them seem to have:
1 - Search and repalce with Regular Expressions.
2 - Search and Replace in an Xpath context.
3 - User specified tag-generation for either on a...
|
by: milkyway |
last post by:
Hello once more,
Sorry if this question has already been asked but here goes:
Does such a thing as a WYSIWYG XSLT editor exist? If so, where might
one download this?
TIA
|
by: Rhino |
last post by:
Can anyone recommend a good *free* XML editor? I tried a demo of Altova
XMLSpy and thought it was pretty neat but I just can't afford it right now.
I'd like to get something free that does a decent job, even if it isn't as
slick as XMLSpy.
--
Rhino
---
rhino1 AT sympatico DOT ca
"There are two ways of constructing a software design. One way is to make it
| |
by: dh.evolutionnext |
last post by:
Hey, I am an instructor and I have an XML class coming up. I would just
like to know a good, easy, and intuitive XML editor that does
validating, code completion, etc. I usually use NetBeans but that is
too java-centric. I want something neutral.
|
by: Johann Höchtl |
last post by:
Hello!
I am searching for a visual schema editor for eclipse. The only ones i came
across was the altova XMLSpy and oxygen, both are commercial. Are there any
good free editors available? Schema validation would be nice but is not a
must.
Greetings,
Johann
|
by: John Baima |
last post by:
Okay, so I know that there is probably not a "simple" XML editor, but
I would like something fairly lightweight that I can buy for someone
else so that they can edit an XML text that I've created (it's about 3
MB) with a XSD schema. I have XMLSpy 5.x Home Edition from a long time
ago and that was okay (more than I need really), but when I just went
to their site, I did not see anything less than a suite for $500.
Surely there has to be...
|
by: chuck |
last post by:
Hello,
What is a good editor for exploring and looking at an xml/schema file
graphically, and keeps track of namespaces?
Thanks.
-c
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |