Hello, I am working on one Windows Application where some of the Forms has a more than 50 controls.. when these forms shows it shows with flicker. and it seems very ugly. i used the Following code for form
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.ExStyle |= 0x02000000;
return cp;
}
}
|
it works fine as i wanted, in vista but it has a problem with list_view. first time it paints with black rectangle and then normally paints. when the application runs on XP, Problem is with Datagridview .. all the border form all Datagridview lost..and it hung the form. can anyone please know how to solve this??? i already tried Double buffered and Opacity trick but it didn't help much.
try abcPosted Nov 16, 2009, 11:41 PM
It Works and Flicker gone.. But as a side effect when Form loads, list view does not paint properly... It shows black rectangle on the list view area first. After few second it shows list view properly. This happen only when I am running application on vista.While running on XP Flicker gone... But Datagridview Does not paint properly... All the border of Datagridview gone away.. It makes the Form hang.Only code I am using is the above one,, if i cooment out the above Code.. Flicker continue and all the side efeect gone..Sam HobbsPosted Nov 16, 2009, 8:39 PM
Note that the documentation says "The preferred way to add multiple items to a ListView is to use the AddRange method". In other words, a good solution is to get all the data first before showing the form. BeginUpdate is a very easy fix if you are adding items individually.
The BeginUpdate and EndUpdate methods are available for other controls also.
If the problem is not flickering, then please be more clear about what the problem actually is. Your subject says flicker, but you description seems to indicate a different problem. Do you have more than one problem?
jingePosted Nov 16, 2009, 8:10 AM
try abcPosted Nov 16, 2009, 7:30 AM
try abcPosted Nov 16, 2009, 7:27 AM
Try to putting the following in your constructor after the InitiliseComponent call. SetStyle(ControlStyles::OptimizedBoubleBuffer | ControlStyles::UserPaint | ControlStyles::AllDrawingInWmPaint} , true); EDIT: you can, remove your own double buffering code and just have the control draw itself in response to the appropriate virtual methods being called.
Kirtan PatelPosted Nov 16, 2009, 7:16 AM
If you are using Heavy Background Images instead you can use GDI+ to form background .
2. Increase your Computer memory :)
this will solve your problem :)
if my answer helps you then mark "Do you like this answer check box" :)
Lalit MPosted Nov 16, 2009, 7:09 AM
Try to putting the following in your constructor after the InitiliseComponent call.
EDIT:
you can, remove your own double buffering code and just have the control draw itself in response to the appropriate virtual methods being called.