Solved

How do I center child form in mdi form?

Posted on 1998-07-16
5
394 Views
Last Modified: 2008-02-01
hi, I am trying to center mdi child form in the mdi parent form.
I had a centerform function written already, what events should I call from?
Right now I called the function from mousemove event. So every time I resize the form, I have to move the mouse on the form to center the form in mdi main form. Otherwise it will stay un-centered. I tried to call it from form_resize event, but It does not center the form when I move the border of the form. And there is no event called after_resize :(

So what should I do to call centerform function after I resize the form?

Thank you very much and have a nice day!

:)
ny971181
0
Comment
Question by:ny971181
  • 3
  • 2
5 Comments
 
LVL 6

Expert Comment

by:clifABB
Comment Utility
frmChild.Move (mdiParent.ScaleWidth - frmChild.Width) / 2, (mdiParent.ScaleHeight - frmChild.Height) / 2

0
 
LVL 1

Expert Comment

by:wford
Comment Utility
Looks like this function goes in the MDIform_Resize with out any problems, I would move it out of the mousemove event if I were you.


0
 
LVL 1

Expert Comment

by:wford
Comment Utility
Ummm, why didn't ClifABBS code work?
0
 
LVL 6

Expert Comment

by:clifABB
Comment Utility
I'm guilty of one of my own pet peeves, people who don't read the question thoroughly!

ny971181 already had the centering code, s/he just wanted to know where to put it, which you did comment, and should answer.
0
 
LVL 1

Accepted Solution

by:
wford earned 50 total points
Comment Utility
ok well, I'll answer, but ny971181 said that the centre function was in the form resize event and didn't work, but i tryed it and it seemed to go quiet hapily, so ny971181 did it work?
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now