By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,897 Members | 1,580 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,897 IT Pros & Developers. It's quick & easy.

Controls Flash Out Of Place On Form Resize

P: n/a
Hi all.

I'm designing a program that has to run on multiple resolutions and I'm
having trouble with moving contols on the form.

The way I have it now, the form is maximized on load, and the following
code is run when the form is resized (incl. on load of course):

Public Sub CenterControls(ByVal Form As Form)
Dim intFrameLeft As Integer
Dim Control As Control
intFrameLeft = Form.fraPositionControl.Left
If Form.InsideWidth < Form.fraPositionControl.Width Then
Form.InsideWidth = Form.fraPositionControl.Width
End If
Form.fraPositionControl.Left = (Form.InsideWidth -
Form.fraPositionControl.Width) / 2
For Each Control In Form.Controls
If Control.Name <> "fraPositionControl" Then
Control.Left = Form.fraPositionControl.Left + (Control.Left
- intFrameLeft)
End If
Next Control
Form.Visible = True
End Sub

This centers the controls without issue, but there is a brief flash
where the controls can be seen in their original position and then
reappear centered. I made a temporary fix of this by making controls
invisible in design and making them visible again on load. This works
beautifully, if kinda sloppy.

The problem is when I return to a form having already left it, the
flash returns.

Any suggestions on what i could do / what I'm missing?


Nov 13 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.