I have a winforms application in which I have used many Custom Controls like buttons, panels and tabs. And the panels will be used almost for every layout in the Application. Now i have added the following DoubleBuffer in the constructor of the panel.
public partial class MainPanel : Panel
{
public MainPanel()
{
//ControlStyle is enum of system.windows.forms
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.DoubleBuffer, true);
SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
}
}
Also after creating the application I had lots of flickering issues, ie when ever I tried to run the application, due to 'n' number of panels my application flickered a lot. So googled a lot and found few solution among which the following one worked out for me
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.ExStyle |= 0x02000000; // Turn on WS_EX_COMPOSITED
return cp;
}
}
using the above code reduced my flickering issues, however it takes a fraction of second to show the form(as the logic of the code is to wait untill all the controls are painted) Im completely ok with the delay(which is hardly few microseconds).
My application works on Windows 7(all versions), Windows 8, Windows 8.1 but when it comes to Windows XP(SP 2 but didnt try other versions) the application runs, but frequently hangs. However there is no crash of the application. But the application freezes a lot in XP. The framework version I'm using is .Net 3.5 and I'm installing .Net 3.5 framework on the machine when the application installs(using NSIS).
The application I have compiled for x86 so that it can run on any bit machine. As far as I know I have covered every possible thing. But still I'm facing this issue. Is there something obvious that I'm missing?
Is there any issue with my Application regarding XP??
PS: Eventhough Microsoft has terminated support for Windows XP I still have to launch the application for XP users.
Thanks in Advance