Discussion Locked

MDI Form in VB

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I wanna displaying MDI child in MDI Form in the center of the app. I tried in MDI child properties StartUpPosition to CenterOwner or CenterScreen and it said "Invalid property value"

Anyone could help me,pls?

5 replies

by hery

Try this

Private sub Form_Load()
Me.Left = MDIForm1.Scalewidth / 2 - Me.Width / 2
Me.Top = MDIForm1.ScaleHeight / 2 - Me.Height / 2
End Sub

by francodacosta

use the following code in the form resize event.

me.move (mdiform1.scalewidth - me.width)/2, (mdiform1.scaleheight - me.height)/2

This code is faster than using the form's Top and Left properties

This discussion is closed to new replies.