Hi
I am trying to get a form to rearrange itself when it maximises so that the working panel is in the middle.
No big deal I thought. But it turns out I cannot stop it flickering like mad!!
I have this for the initialisation:
And this is the actual code:
Now I have used all sorts of variations on this.
I've put refresh into the code, I've tried putting the doublebuffering code into the designer.vb, I've attempted to make the panHolder, (a panel), doublebuffer = true and am told I can't access it.
There MUST be a simple solution to this but I can't find it.
Supposedly Panels don't double buffer? Will the children of the panel double buffer? These are also largely panels.
I have seen that you can create panels that can double buffer but these can't be added at design time and I dread having to rebuild the entire structure from scratch on run time. (Altho I realise that happens in the designer and I can just C&P much of that code!)
Any suggestions greatly welcomed.
I am trying to get a form to rearrange itself when it maximises so that the working panel is in the middle.
No big deal I thought. But it turns out I cannot stop it flickering like mad!!
I have this for the initialisation:
Code:
Public Sub New()
MyBase.New()
InitializeComponent()
Me.SetStyle(ControlStyles.DoubleBuffer Or ControlStyles.UserPaint Or ControlStyles.AllPaintingInWmPaint, True)
Me.SetStyle(ControlStyles.ResizeRedraw, True)
Me.DoubleBuffered = True
End Sub
And this is the actual code:
Code:
Private Sub frmMain_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
Dim x As Integer = Me.Width
Dim y As Integer = Me.Height
x = (x / 2) - 443
y = (y / 2) - 315
PanHolder.Left = x
PanHolder.Top = y
End Sub
I've put refresh into the code, I've tried putting the doublebuffering code into the designer.vb, I've attempted to make the panHolder, (a panel), doublebuffer = true and am told I can't access it.
There MUST be a simple solution to this but I can't find it.
Supposedly Panels don't double buffer? Will the children of the panel double buffer? These are also largely panels.
I have seen that you can create panels that can double buffer but these can't be added at design time and I dread having to rebuild the entire structure from scratch on run time. (Altho I realise that happens in the designer and I can just C&P much of that code!)
Any suggestions greatly welcomed.