|
-
Jul 28th, 2000, 09:39 AM
#1
Thread Starter
Lively Member
I try to set the StartupPosition property for an MDI Child form to start up in the center of the MDI form. It returns an error. Something like "Cannot set this property". I don't remember.
The child forms normally start up in the upper left hand corner of the MDI window and cascade from there.
It's not important but if anyone knows how to set the startup position for an MDI child form that would be great.
Just curious.
-
Jul 28th, 2000, 09:41 AM
#2
Try this.
Code:
Private Sub MDIForm_Load()
Form1.Move (Me.ScaleWidth / 2) - (Form1.Width / 2), (Me.ScaleHeight / 2) - (Form1.Height / 2)
End Sub
-
Jul 28th, 2000, 10:26 AM
#3
u can try these too....
Private Sub MDIChildForm_Load()
me.Move (Me.Parent.ScaleWidth / 2) - (me.Width / 2), (Me.Parent.ScaleHeight / 2) - (Me.Height / 2)
End Sub
-
Jul 26th, 2001, 09:26 PM
#4
Junior Member
I used Megatron's code. It doesn't seem to be working correctly. The child form ends up partially off of the left side of the screen. Here is the code that I used:
Private Sub MDIForm_Load()
frmUpdate.Move (Me.ScaleWidth / 2) - (frmUpdate.Width / 2), (Me.ScaleHeight / 2) - (frmUpdate.Height / 2)
End Sub
I put this in the mdiform's code. My mdiform is set to be maximized to the user's screen on load.
-
Jul 26th, 2001, 11:00 PM
#5
Junior Member
I was able to get it to work by changing it to this:
Private Sub Form_Resize()
Me.Left = (MDIForm1.Width - Me.Width) / 2
Me.Top = (MDIForm1.Height - Me.Height) / 2
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|