.Net Flicker Fee Controls
Here are the steps to use this control:
1. Add new class "NonFlickerSplitContainer" to your C# application.
2. Replace auto generated class code with C# code shown below.
3. Use NonFlickerSplitContainer object instead of SplitContainer object in your application.
public partial class NonFlickerSplitContainer : SplitContainer
{
public NonFlickerSplitContainer()
{
this.SetStyle(ControlStyles.AllPaintingInWmPaint |
ControlStyles.UserPaint |
ControlStyles.OptimizedDoubleBuffer, true);
MethodInfo objMethodInfo = typeof(Control).GetMethod( "SetStyle",BindingFlags.NonPublic|BindingFlags.Instance);
object[] objArgs = new object[] { ControlStyles.AllPaintingInWmPaint |
ControlStyles.UserPaint |
ControlStyles.OptimizedDoubleBuffer, true };
objMethodInfo.Invoke(this.Panel1, objArgs);
objMethodInfo.Invoke(this.Panel2, objArgs);
}
}
Here are the steps to use this control:
1. Add new class "NonFlickerSplitContainer" to your C# application.
2. Replace auto generated class code with C# code shown below.
3. Use NonFlickerSplitContainer object instead of SplitContainer object in your application.
public partial class NonFlickerSplitContainer : SplitContainer
{
public NonFlickerSplitContainer()
{
this.SetStyle(ControlStyles.AllPaintingInWmPaint |
ControlStyles.UserPaint |
ControlStyles.OptimizedDoubleBuffer, true);
MethodInfo objMethodInfo = typeof(Control).GetMethod( "SetStyle",BindingFlags.NonPublic|BindingFlags.Instance);
object[] objArgs = new object[] { ControlStyles.AllPaintingInWmPaint |
ControlStyles.UserPaint |
ControlStyles.OptimizedDoubleBuffer, true };
objMethodInfo.Invoke(this.Panel1, objArgs);
objMethodInfo.Invoke(this.Panel2, objArgs);
}
}
Amazing solution... spent the last 4 hours hunting and found yours. Thanks a million!!!
ReplyDeletecan i make a facebook application by C SHARP ?
ReplyDeleteThanks for appreciations!!!
ReplyDeleteThank You!
ReplyDeleteThanks a lot!!! It actually helped me to solve the issue. some how my application was continuously taking 25% CPU for repaint when i used create param. i just commented it and followed your approach, it worked like charm, as it is now painting only the splitter control.
ReplyDeleteThanks Haseena.
ReplyDeleteThis comment has been removed by the author.
ReplyDelete