Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Make MDI Child form Centre
Message
De
08/07/2000 05:25:58
 
Information générale
Forum:
Visual Basic
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00388770
Message ID:
00389804
Vues:
11
>>>>How to make the display of a Child MDI form to always display
>>>>in the Centre of the screen everytime a .Show command is issued?
>>>
>>>In your child form, add this:
>>>
>>>Private Sub Form_Resize()
>>>    Me.Left = (MDIForm1.ScaleWidth - Me.Width) / 2
>>>    Me.Top = (MDIForm1.ScaleHeight - Me.Height) / 2
>>>End Sub
>>>
>>
>>I faced a run-time error as follows:
>>
>>Run-time error '426'
>>Only one MDI Form allowed.
>>
>>Private Sub Form_Resize()
>> Me.Left = (frmMDIMain.ScaleWidth - Me.Width) / 2
>> Me.Top = (frmMDIMain.ScaleHeight - Me.Height) / 2
>>End Sub
>>
>>I changed MDIForm1 to my MDI form named "frmMDIMain".
>
>Have you placed this code in your child form? Do you have more than 1 MDI form in your project?

It is solved, because I have Set fMDIForm = New frmMDIMain, therefore the
MDI form name should be fMDIForm instead of frmMDIMain.

I learned the method of assigning a form into another name, like the above
example. What are the advantages of doing in this way, rather then calling
the form directly? As I learned this method from other people's applications.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform