Solved

How do I center child form in mdi form?

Posted on 1998-07-16
5
398 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
ID: 1466013
frmChild.Move (mdiParent.ScaleWidth - frmChild.Width) / 2, (mdiParent.ScaleHeight - frmChild.Height) / 2

0
 
LVL 1

Expert Comment

by:wford
ID: 1466014
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
ID: 1466015
Ummm, why didn't ClifABBS code work?
0
 
LVL 6

Expert Comment

by:clifABB
ID: 1466016
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
ID: 1466017
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Visual Basic Excel Formatting error 4 128
Create Files based on Cell Values in a Range in Excel 12 43
which modules are active in VB6 project? 6 44
Problem to line 23 55
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

821 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