|
Hi, I have an application where users can do many find/replace operations, including regexes. The problem is that if the user wants to replace something with a carriage return/newline and enter \r\n it literally replaces with "\r\n", however if I try the same thing but in the code, and specify a regex to replace something with \r\n it does replace with a carriage return/newline.
Otherwise the regex works properly, for example the user can find a carriage return/newline with \r\n and they can replace with $1 for example, but it just doesn't work when you try and replace with \r\n .
thanks for any help!
|
|
|
|
|
If the user types this into the textbox it's like you would define the string like the following:
string s = @"\r\n";
or
string s = "\\r\\n";
You could replace it manually within your code:
string s = s.Replace(@"\r, "\r).Replace(@"\n", "\n");
|
|
|
|
|
|
Hi All
I have created a custom component which is just a gradient filled background. It all works well until resized as only the new area is redrawn.
How can I call repaint so that the entire component is redrawn instead of being invalidated?
Thanks
Nick James
|
|
|
|
|
Two methods:
1. Override OnResize and call Invalidate() (without parameters).
2. Put base.SetStyle(ControlStyles.ResizeRedraw, true); into your constructor.
Don't call Refresh() . It could reduce performance.
|
|
|
|
|
Thanks Robert, that worked a treat.
I knew there should be a one line answer. I've never looked at the ControlStyles objects until now.
I added the following lines:
<br />
base.SetStyle(ControlStyles.ResizeRedraw, true);<br />
this.SetStyle(ControlStyles.DoubleBuffer, true);<br />
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);<br />
this.SetStyle(ControlStyles.UserPaint, true);
So now I have double buffering with no flickering when the user resizes the control.
Once again thanks, and thanks to the Code Project for an excellent site.
|
|
|
|
|
Hi all !
How is the future of C#.net ?
is there any source ?
thanx !
s_mostafa_h
|
|
|
|
|
The future will be fine
The C# 3.0 specs are already out and Microsoft will support .NET even more than it does right now.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
"The future's so bright, I've gotta wear shades."
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
from which way , you're sure to say !
s_mostafa_h
|
|
|
|
|
i am trying to remove string with preceding and trailing spacesin C#.NET
strTemp = Regex.Replace(strTemp, @"^\s*(.*?)\s*$", "$1");
this is not working please help me.
thank you
|
|
|
|
|
strTemp = strTemp.Trim();
---
b { font-weight: normal; }
|
|
|
|
|
Thanks i try that code, but i was putting ' around my string thats why Trim() did't work for me. Thanks for ur help, i got it working
|
|
|
|
|
Hi All,
I am looking for some sample code for printing the content of the a tree view control. I was just curious if someone had any ideas.
Thanks
JS
|
|
|
|
|
I may have the wrong idea, but why not just make a richtextbox, have it paste in the contents of each node, and on each node level tab it?
|
|
|
|
|
Hi James,
That would do the trick. The only thing is that I need the treeview for some user interaction but I could use the rtb as an intermediate step.
Thanks for your feedback.
JS
|
|
|
|
|
I would like to be able to mark a webmethod as obsolete by applying the obsolete attr to the method. What i really want out of this is for the description of the webmethod to show that this is a deprecated method and not to use it. Using this with non webmethods works just fine.... any tricks?
|
|
|
|
|
And what is a webmethod?
I have never heard of such thing...
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
hi
can anyone help to solve my problem.
i have two picture boxes one on top of other.the picture box behibd the top one shows live video from web cam . i want the picture box on top to be transparent so that i can view the video in the second picturebox through the transaprent one for c# application.
thanks ramya
|
|
|
|
|
Check out MSDN Library on "ControlStyles" flag and "SupportsTransparentBackColor" and "Opaque" style. By using these styles and providing a background color with an "alpha" value you can make it transparent. All you need is to play with the alpha level of the System.Drawing.Color structure.
Bluehunter
|
|
|
|
|
hi all !
I want to take a report from all of information of my Form1 by Crystal Report .
I have to put CrystalReportViewer in Form2 .I want to take a report from Form1 , for example when my record number is :2 .How can i do it?
(i can go to next or before record by the next or before buttons in Form1).
THANKS A LOT !
REGARDS ,
s_mostafa_h
|
|
|
|
|
you should just use a message from form2.and then you will see your form1 can recognize that.if not ,try again.
Always do you best,what you plant you will harvest
later!
|
|
|
|
|
harry~ wrote: you should just use a message from form2 .
how ?
Regards ,
s_mostafa_h
|
|
|
|
|
Hello!
I didn't found anything helpful, so i ask you.
I want to listen to a serial port, but all my tries failed. sending is very easy, but how can i receive 16 and 5 byte being sent coincidentally to this port? just like a serial port sniffer
is there any good tutorial or example?
thx
|
|
|
|
|