![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi, i've created a user control which can be resized at runtime. When the control is resized, it flickers. I use the following controlstyles: this.SetStyle(ControlStyles.UserPaint | ControlStyles.Opaque | ControlStyles.AllPaintingInWmPaint, true); I've also tried double buffering, but this seems to have the weird effect of disabling the OnPaint method (never triggers, but the child controls are still painted). A similiar post suggested using the WS_CLIPCHILDREN, but i do not know how to change the window style after the window has been created. Any suggestion on how to fix this anoying flickering is highly appreachiated. |
#3
| |||
| |||
|
|
Try to override the OnPaintBackground method in this manner: protected override void OnPaintBackground(PaintEventArgs pevent) { // this line stays commented //base.OnPaintBackground (pevent); } -- Sergey Bogdanov [.NET CF MVP, MCSD] http://www.sergeybogdanov.com MariusI wrote: Hi, i've created a user control which can be resized at runtime. When the control is resized, it flickers. I use the following controlstyles: this.SetStyle(ControlStyles.UserPaint | ControlStyles.Opaque | ControlStyles.AllPaintingInWmPaint, true); I've also tried double buffering, but this seems to have the weird effect of disabling the OnPaint method (never triggers, but the child controls are still painted). A similiar post suggested using the WS_CLIPCHILDREN, but i do not know how to change the window style after the window has been created. Any suggestion on how to fix this anoying flickering is highly appreachiated. |
#4
| |||
| |||
|
|
Hi, i've created a user control which can be resized at runtime. When the control is resized, it flickers. I use the following controlstyles: this.SetStyle(ControlStyles.UserPaint | ControlStyles.Opaque | ControlStyles.AllPaintingInWmPaint, true); I've also tried double buffering, but this seems to have the weird effect of disabling the OnPaint method (never triggers, but the child controls are still painted). A similiar post suggested using the WS_CLIPCHILDREN, but i do not know how to change the window style after the window has been created. Any suggestion on how to fix this anoying flickering is highly appreachiated. |
#5
| |||
| |||
|
|
Also add the ControlStyles.DoubleBuffer or ControlStyles.OptimizedDoubleBuffer (depending on the framework version you use). So the line will read: this.SetStyle(ControlStyles.UserPaint | ControlStyles.Opaque | ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer, true); This will reduce the flickering almost to probably zero otherwise you might have a problem in your code that is unneccisserily calling the OnPaint event/method multiple times for no reason. Hope it helps, Poolbeer "MariusI" <MariusI (AT) discussions (DOT) microsoft.com> wrote in message news:2315558A-D71D-4F86-AFE3-8918E6E3736F (AT) microsoft (DOT) com... Hi, i've created a user control which can be resized at runtime. When the control is resized, it flickers. I use the following controlstyles: this.SetStyle(ControlStyles.UserPaint | ControlStyles.Opaque | ControlStyles.AllPaintingInWmPaint, true); I've also tried double buffering, but this seems to have the weird effect of disabling the OnPaint method (never triggers, but the child controls are still painted). A similiar post suggested using the WS_CLIPCHILDREN, but i do not know how to change the window style after the window has been created. Any suggestion on how to fix this anoying flickering is highly appreachiated. |
#6
| |||
| |||
|
|
the ControlStyles.Opaque ensures that the OnPaintBackGround is never called, so that won't help "Sergey Bogdanov" wrote: Try to override the OnPaintBackground method in this manner: protected override void OnPaintBackground(PaintEventArgs pevent) { // this line stays commented //base.OnPaintBackground (pevent); } -- Sergey Bogdanov [.NET CF MVP, MCSD] http://www.sergeybogdanov.com MariusI wrote: Hi, i've created a user control which can be resized at runtime. When the control is resized, it flickers. I use the following controlstyles: this.SetStyle(ControlStyles.UserPaint | ControlStyles.Opaque | ControlStyles.AllPaintingInWmPaint, true); I've also tried double buffering, but this seems to have the weird effect of disabling the OnPaint method (never triggers, but the child controls are still painted). A similiar post suggested using the WS_CLIPCHILDREN, but i do not know how to change the window style after the window has been created. Any suggestion on how to fix this anoying flickering is highly appreachiated. |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |