I can't seem to elimate flicker. I'm drawing to a panel via its OnPaint.
I've tried setting the form's doublebuffer to true, to no avail, so I tried
using ControlStyles.OptimizedDoubleBuffer, still no good. Then I tried
using good old BufferedGraphicsContext in the panel OnPaint, which has
always worked for me in the past, but I am still getting flicker. It's
driving me crazy. All I'm doing is drawing a couple of GraphicsPaths to the
panel. As soon as I start doing any translation or rotation I get flicker.
Not sure where to go from here. Any suggestions?
Here's the exe demonstrating the problem, can upload source too if required:
http://nrkn.com/temp/VectorRl.exe
You need to set the double buffering of the panel, not the form.
Michael
PS, I don't think anyone's likely to run an exe.
A panel doesn't have a doublebuffered property. Aside from which, I'm using
manual double buffering (via BufferedGraphicsContext) on the panel, and I'm
still getting flicker.
Correction, it does have a doublebuffered property, but it's protected so I
can't use it. Shouldn't matter though, given that I'm doing it manually.
Try inheriting then and setting it.
> Shouldn't matter though, given that I'm doing it manually.
It should definately work.
>
>
I generally do this stuff in a usercontrol anyway.
I'll give it a try, thanks
Awesome, thanks.
Child controls have their own windows and so would need their own double
buffering turned on in order to eliminate flicker from their surfaces.
Double buffering the form will not affect any child controls or their
own contained controls. Basically, for forms, user controls and
container controls of all types double buffering us useless.
--
Bob Powell [MVP]
Visual C#, System.Drawing
Ramuseco Limited .NET consulting
http://www.ramuseco.com
Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
Thanks Bob. I just (foolishly) assumed that because the doublebuffered
property of child controls was protected that it must be inherited from the
form.
I ask as I have a splitcontainer which holds 2 usercontrols. Each
usercontrol has many panels with various controls on them. The panels are
positioned at runtime and change positions based on a a user selected type.
When a new type is selected you can watch the usercontrol being repainted.
I've so far tried suspend/resume layout. Inheriting the panels and setting
doublebuffered to true.
The user control however still has an ugly slow repaint. We're quite a way
down the development path so it's too late to attempt all this in xaml.
Any ideas on how to ensure double buffering is working correctly?
"Nik Coughlin" <nrkn...@gmail.com> wrote in message
news:etpimb$o1h$1...@aioe.org...