|
Hi!
Although I cannot really follow what you're trying to do, it seems as if a different way would be much easier:
Create a (invisible) RichTextBox , load the RTF document into this box, find the lines you want to colorize using the Text property of the RTB, select them and then assign the SelectionColor you want.
Afterwards you can simply assign the invisible RTB's Rtf property to the target RTB and you're done.
If you really want to modify the RichText yourself, I suggest reading the Rich Text Format (RTF) Specification, version 1.6[^], but a quick scan through the introduction will show you that it's not as easy as you might think.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
I have tried having the RichTextBox is both visible and invisible. No difference in the time it takes for the SelectionColor. It takes 3 -4 minutes regardless.
My goal is to speed up the process for this.
If I select all text and change it to BOLD it takes a second or two, if I change the color of all the text it takes the same time.
Your right the RTF spec is not easy.
Brian
|
|
|
|
|
I don't have a quick and easy answer for you, but you probably weren't expecting one. I can offer a little help though, I hope. I have used RichTextBox controls a little bit, but what I was doing was writing a simple "report, " saving it to a file, sending it to a client application that then displayed the file in a RichTextBox control.
Anyway, you said you wanted to use the .Rtf property. I didn't use it, but as I understand it, you'd need to load your rtf-formatted text into a string object, then
<br />
string rtfString = ;<br />
rtbDoc.Rtf = rtfString ;<br />
What I did was:
<br />
richTextBox.LoadFile ( path ) ;<br />
I don't think that the .Rtf property is going to be much help, though. Here are my assumptions about things you've done so far:
You have data in a text-based file captured from a device or other source.
You opened a data file in Wordpad and found the text of interest.
You changed the interesting text to bold and blue.
You saved the result as .rtf file.
A portion of that file is shown in your post.
<br />
\cf1\b 01\cf0\b0<br />
This portion of that text means color foreground #1 from color table, bold, 01 (which is the interesting text), color foreground #0 (back to default color), bold off. The color table is defined on line 2:
<br />
{\colortbl ;\red0\green0\blue139;}<br />
I don't think that the 3 - 4 minute delay really has anything to do with rtf issues. I think that's time taken for findSequenceNumbers to parse the strings. I'd try putting some debug statements before and after a call to it. Find out how much time it is taking.
If my first assumption above is correct, my approach would be to process the data file a line at a time, looking for the tokens as seen in findSequenceNumbers and embedding the rtf instructions
<br />
\cf1\b <br />
and the like in the lines. Of course you'd also have to put the other rtf stuff in your StringBuilder or whatever. Not sure if that's really going to speed things up or not, it's just another way to skin the cat.
Hope this helps a little.
BDF
|
|
|
|
|
Your assumptions were correct.
Puts things in a different perspective, and I appreciate the answer.
'
Brian
|
|
|
|
|
Hi friends
Well i m new to this concept and I want to know the OS info of other pcs which are connected through lan.
But I m getting below error
"User credentials cannot be used for local connections"
Can any one please tell me wants wrong with the below code.
ConnectionOptions co = new ConnectionOptions();
co.Username = "abhi";
co.Password = "Software123";
ManagementScope ms = new ManagementScope("\\abhi\\root\\cimv2", co);
ObjectQuery oq = new ObjectQuery("Select * from Win32_OperatingSystem");
ManagementObjectSearcher mo = new ManagementObjectSearcher(ms,oq);
ManagementObjectCollection AllObjects = mo.Get();
foreach (ManagementObject DemoObject in AllObjects)
{
Console.WriteLine("Resource Name : " + DemoObject["Caption"].ToString());
Console.WriteLine("Resource Name : " + DemoObject["Version"].ToString());
Console.WriteLine("Resource Name : " + DemoObject["Manufacturer"].ToString());
Console.WriteLine("Resource Name : " + DemoObject["csname"].ToString());
Console.WriteLine("Resource Size : " + DemoObject["WindowsDirectory"].ToString());
Abhishek
Mumbai, India
|
|
|
|
|
Please refer to this site:
www.experts-exchange.com/Programming/Languages/C_Sharp/Q_22105229.html#discussion[^]
ConnectionOptions cno = new ConnectionOptions();
cno.Impersonation = ImpersonationLevel.Impersonate;
cno.EnablePrivileges = true;
cno.Username = "adminUid";
cno.Password = "adminPwd";
ManagementScope ms = new ManagementScope(@"\\remote_pc\root\cimv2", cno);
ObjectQuery qry = new ObjectQuery("Select * from Win32_Process");
ManagementObjectSearcher srch = new ManagementObjectSearcher(ms, qry);
ManagementObjectCollection col = srch.Get();
|
|
|
|
|
HI all,
My client asked me convert the VS.NET2003 solution into VS.NET 2005. I resolved compile time issue and build my installer successfully. When executed, it is giving me exception at certain places.
1.Marshal.ActiveObject("XXX"), Exception occurred at this place.
this works fine when i build code using 2005.
2.I have a web-services which polls for any updates after periodic interval (configurable), if updates are available then download the updates and restart the exe.
Even if the interval is set to 10 to 15 mins, the exe is restarting within less than a minute.
--> Is there any specific requirement in VS 2005.
Both the problems appeared in VS 2005 build only.
Any pointers are greatly appreciated.
Thanks in advance
Abhi Lahare
|
|
|
|
|
Abhi Lahare wrote: this works fine when i build code using 2005
If it is working fine when you build on 2005, where is it causing the problem?
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hi All
How I Can save the value from TextBox Control with formate as
the value in textbox is 12036 and the value save as formate 12036,00 in DataBase How I Can Do that by use the Formate string
thank for any body hellp me
Thaer
|
|
|
|
|
Lets clarify.
Textbox = "12036"
Formatted Textbox Value = "12036,00"
You want "12036,00" in the database, but you get "12036". To preserve this value in the database, make sure the column you are saving to is a string column. If you save to a numeric/decimal column, then it will save the number without the formatting.
Hope this helps.
Hogan
|
|
|
|
|
Snorkie,
I think 12036,00 actually means 12306.00. Some cultures use (e.g. most of Europe excluding the UK & Ireland) "," as the decimal separator. Some cultures (mostly Arabic) use a something like a forward slash. So much for maths being a universal language!
|
|
|
|
|
snorkie wrote: make sure the column you are saving to is a string column
If it is number store it as number. Let UI decide how to formate that number.
[ My Blog] "Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
You should do something like:
decimal amount = decimal.Parse(textBoxName.Text);
where textBoxName is the name of your text box. You should save this into the database as a decimal data type, the formatting is not important. You should also look up decimal.TryParse as it will probably be more useful.
|
|
|
|
|
Hello,
You should convert the string to a double value, using double.TryParse (with the CurrentCulture setting).
And than do the String Format.
Here an example with a dynamic number of decimal places:
string text = "123";
string formatedText;
int NumberDecPoints = 2;
double d = 0;
if(double.TryParse(text, System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.CurrentCulture,out d))
{
formatedText = String.Format("{0:F" + NumberDecPoints.ToString() + "}", d);
}
All the best,
Martin
|
|
|
|
|
Are you trying to save the value from the TextBox Control '12036' to the database as '12036.00'? Two things I would check. Make sure the column in the database is a varchar, string or a decimal value. Second, use the decimal.Parse method to get the correct format, then send it to the database.
|
|
|
|
|
Hi,
Actually I want to execute all events of web application through request….,
but I only succeed for button's click event and not for all other like image button and anchor element like that…….
The difference between button event & image button event is that button event is related to delegate System.EventHandler and image button to System.Web.UI.ImageClickEventHandler. The link button event also works fine through request because it's event also related to delegate System.EventHandler....
I have also problem with how to call the click event of anchor element bcaz it is client side element.
I am implementing all these from windows application…..., If u have any information then please reply….……..
Bye....
Dipti
|
|
|
|
|
i have to develope an image processing program.
images r face pics.
i find acne scars, shadowed areas then draw lines around of them.
how do i do ? how can i find out this scars.
where is the start point?
|
|
|
|
|
I've not actually tried this sort of thing, but I've heard it is pretty complicated, the subject of PhD theses and research projects. That being said it's an interesting puzzle.
Edge detection may be of some help:
http://en.wikipedia.org/wiki/Edge_detection[^]
Also you could look at the wikipedia on Feature Extraction (The bit about image processing is relevant)
http://en.wikipedia.org/wiki/Feature_extraction[^]
I'm not sure whether there is any research applying AI techniques (e.g. fuzzy logic or nueral networks) to this problem, but that might be worth some research. You might want to look at functional languages such as F#, Scheme or Haskell etc for handling the maths as it will be quite involved.
Good luck anyway.
|
|
|
|
|
greekius@hotmail.com wrote: i have to develope an image processing program.
images r face pics.
i find acne scars, shadowed areas then draw lines around of them.
how do i do ? how can i find out this scars.
where is the start point?
This will be a very difficult project. I don't even have a guess as to how to start, but if I was you, I would talk with your project manager. If you don't know where to start, you probably aren't qualified for that specific project.
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
I develope alone no project Manager. if there is one, He is me
|
|
|
|
|
This is seriously going to take a lot of work, and im talking months of work.
Unless you know an extensive amount of GDI+ and some image algorithm's to do this, you're probably better off getting a third party program that specializes in this.
But if I were to start somewhere, it would definitely be researching. Unless I know how to do it, I would start researching about it. Look for Image processing/cleanup in google, maybe that could give you a good starting point.
|
|
|
|
|
I've got a GUI which sends commands to a console exe, my backend which does the actual processing. But whenever my frontend calls it, it opens a command console window (even though I don't have any output on screen), but I'm having difficulties to find:
- whether I can force the pop-up exe to always stay in the back
(I was thinking on a) calling the exe b) immediately getting focus back on my GUI)
- maybe there's a way to call the exe, as I'm doing, but send it's window to the system tray (not like the icons and clock of Windows, I mean the space on the left to it, like most programs when you manually minimalize them)
But the prefered way how I'd like to handle it:
- have the exe and it's totally obsolete console window, be nothing more than a process I can find in Taskmanager. AKA not visible to the user.
Any ideas?
|
|
|
|
|
You can use process class to launch the another process. If you wan't that process to run in an invisible mode then create an instance of ProcessStartInfo class, set its WindowStyle property to Hidden and set CreateNoWindow property to true. Then use the ProcessStartInfo object to start a new invisible process.
|
|
|
|
|
Why should I ALSO set the CreateNoWindows property to true, if the WindowStyle is allready invisible? I've tried it, and don't see why I should use the CreateNoWindows.
|
|
|
|
|
Because from some programs setting WindowStyle to invisible is not enough
|
|
|
|