|
-
Mar 3rd, 2005, 07:05 PM
#1
Thread Starter
Lively Member
MDI Child Forms [Resolved]
Hi,
Is there a way to move a form before it becomes visible when it is an MDI child?
I've tried setting the visible property to false at design-time, then using code to centre and show the form, but the form flashes for a second in its initial position before moving, which doesn't look great.
Any ideas?
Last edited by olamm2k; Mar 3rd, 2005 at 08:23 PM.
-
Mar 3rd, 2005, 07:22 PM
#2
Re: MDI Child Forms
Are you positioning the child form in the MDI form load or child form load?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Mar 3rd, 2005, 07:26 PM
#3
Thread Starter
Lively Member
Re: MDI Child Forms
Well, the first form is loaded like this:
VB Code:
Private Sub MDIForm_Load()
frmTemplate.Left = (Me.ScaleWidth - frmTemplate.Width) / 2
frmTemplate.Top = (Me.ScaleHeight - frmTemplate.Height) / 2
frmTemplate.Show
End Sub
And the subsequent forms are loaded like this:
VB Code:
Private Sub cmdMembers_Click()
frmDispMem.Left = Me.Left
frmDispMem.Top = Me.Top
Unload Me
frmDispMem.Show
End Sub
-
Mar 3rd, 2005, 07:55 PM
#4
Thread Starter
Lively Member
Re: MDI Child Forms
I've just been experimenting some more...
It seems like the form becomes visible whenever it is loaded, even though the visible property is set to false. I tried a button calling only frmDispMem.Hide, and it still flashed for a second before disappearing.
I don't really seem to be making any head-way at the moment.
-
Mar 3rd, 2005, 08:06 PM
#5
Re: MDI Child Forms
I believe that if you put your centering code in the Initialze event of the child form then you'll be OK.
-
Mar 3rd, 2005, 08:22 PM
#6
Thread Starter
Lively Member
Re: MDI Child Forms
Thanks - it works okay as it is, actually. I worked out what I was doing wrong:
In the form's Load event, I had included a Me.Show line because I was drawing a line on the form using code. This meant that when I tried to set any property or call a method of that form, the Load event fired and showed it.
Oops!
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
|