I created a simple custom controlled Panel for double buffering. When I use the control in my toolbox it works just fine, but when I attempt to add controls inside the panel those controls aren't staying when I move the panel around. My custom panel isn't acting as the controls' parent. I verified this by looking in the designer code.
I tested a standard panel on the same form and it works perfectly normal - as I drag the parent Panel the interior controls move along with it. It is only my custom Panel which doesn't seem to detect when another control is placed within it.
Here is my constructor code:
What am I missing to get this control to behave like a regular panel?Code:Public Class DBPanel Inherits System.Windows.Forms.PictureBox Public Sub New() MyBase.New() SetStyle(ControlStyles.OptimizedDoubleBuffer Or ControlStyles.UserPaint Or ControlStyles.AllPaintingInWmPaint, True) SetStyle(ControlStyles.ResizeRedraw, True) Me.UpdateStyles() End Sub End Class
Thanks!





Reply With Quote