|
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
|
|
|
|
|
|
|
|
I want to create an Windows Service which displays notifynicon on the taskbar with contextmenu. If user choose "show management panel" from the context menu a simple Windows Form appears and user can modify service behaviour form it.
So what is the problem?
1.
I created simple WIndows Service (local system whith access to the desktop) and added NotifyIcon and contextmenu components to it. When I rum my service notify icon appears on the taskbar and everything seems to work properly... but when I right-click on the icon context menu does not appear. What's more - I added double-click event for the NotifyIcon and It also does not work properly - Message box does no appear.
The same components in simple Windows Form Application work well. So I thought that I must add windows form to the service to make it work.
2.
Maybe, but Application.Run(new MainForm()); needs to be invoked in different thread because service waits for the WIndow to be closed - there must be much more simple way to do it.
I'm new to Windows Services, coud you help me with my problem?
|
|
|
|