471,325 Members | 1,568 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,325 software developers and data experts.

Flickers

Hi all,

We have a windows forms application with different controls used
inside, each control has several input items such as textboxes , custom
labels, user controls, and some treeviews.. etc.
We have been trying to eliminate flickering issues when loading different
controls or switching to different views with no luck, and have been trying
different suggested methods to get rid of the flickering such as:
- this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
- this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
- SuspendItemsLayout();
- ResumeItemsLayout();
Unfortunately using the above code in each control or the main form
didn't help too, I'm wondering desperately if there is another way to
fix this annoying problem?
FYI: We are using Visual Studio 2005 Team Suite SP2/ .NET 2.0 running on
mainly
Windows XP Professional SP2 on 3.20 GHz multithreaded CPU and 1GB RAM.
Thanks for your help. Regards, greetings

--
http://www.alhambra-eidos.es/web2005/index.html
www.kiquenet.net
http://www.setbb.com/putainformatica...opic.php?p=843
www.trabajobasura.com/solusoft

Aug 1 '08 #1
4 1376
=== original message ===
from: Alhambra Eidos Kiquenet
date: 01.08.2008 09:49
Hi all,

We have a windows forms application with different controls used
inside, each control has several input items such as textboxes , custom
labels, user controls, and some treeviews.. etc.
We have been trying to eliminate flickering issues when loading different
controls or switching to different views with no luck, and have been trying
different suggested methods to get rid of the flickering such as:
- this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
- this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
- SuspendItemsLayout();
- ResumeItemsLayout();
Unfortunately using the above code in each control or the main form
didn't help too, I'm wondering desperately if there is another way to
fix this annoying problem?
Did you try the simple 'DoubleBuffer = true;'

Cheers,
Udo
Aug 1 '08 #2
On Aug 1, 11:49*am, Alhambra Eidos Kiquenet
<AlhambraEidosKique...@discussions.microsoft.comwr ote:
*Hi all,

We have a windows forms application with different controls used
inside, each control has several input items such as textboxes , custom
labels, user controls, and some treeviews.. etc.

We have been trying to eliminate flickering issues when loading different
controls or switching to different views with no luck, and have been trying
different suggested methods to get rid of the flickering such as:
- this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
- this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
- SuspendItemsLayout();
- ResumeItemsLayout();

Unfortunately using the above code in each control or the main form
didn't help too, I'm wondering desperately if there is another way to
fix this annoying problem?
One dangerous trick is to use P/Invoke to send WM_SETREDRAW message to
enable/disable redrawing for a specific control. You disable redrawing
before a batch of updates, and enable them once you're done. Something
like this:

internal const int WM_SETREDRAW = 0x000B;

[DllImport("user32", CharSet = CharSet.Auto)]
internal static extern IntPtr SendMessage(IntPtr hWnd, int
msg, int wParam, IntPtr lParam);

void UpdatingMethod()
{
try
{
SendMessage(control.Handle, Win32.WM_SETREDRAW, 0,
IntPtr.Zero);
// Perform your updates here
...
}
finally
{
SendMessage(control.Handle, Win32.WM_SETREDRAW, 1,
IntPtr.Zero);
}
}

Aug 1 '08 #3
What about window form designer code ?? This code has method like
SuspendLayout and others , how can I do updates of control with my custom
control ?

any sample, please ?

Thanks.
Aug 1 '08 #4
On Aug 1, 5:01*pm, Alhambra Eidos Kiquenet
<AlhambraEidosKique...@discussions.microsoft.comwr ote:
What about window form designer code ??
What about it? Flicker typically occurs when you're updating a large
number of controls on the form; whether they were created in the
designer or by hand is entirely irrelevant. You can get the handle of
the entire form, or of a specific panel with controls, by using its
Handle property; and then just do the trick I've described above.
any sample, please ?
Since we have no idea what exactly you're doing that's causing the
flicker - since you haven't posted any code - there isn't much that
can be added.

Aug 1 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Sakharam Phapale | last post: by
8 posts views Thread by nirdeshonline | last post: by
reply views Thread by nirdeshonline | last post: by
4 posts views Thread by jobs | last post: by
3 posts views Thread by Spizzat2 | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.