Solved

# Obtain the width and height of MDI (inner area)

Posted on 2002-03-13
Medium Priority
696 Views
i have some Coolbar, Status Bar attached to the MDI Form.
How to obtain the inner width an height of a MDI Form?
i.e. exclude the height of those controls. (Coolbar, Status Bar)
0
Question by:chnelson

LVL 55

Expert Comment

ID: 6859986
Debug.Print MDIfrmMain.ScaleHeight & " : " & MDIfrmMain.ScaleHeight - MDIfrmMain.Coolbar.Height - MDIfrmMain.Toolbar.Height - MDIfrmMain.StatusBar.Height

?

0

LVL 1

Author Comment

ID: 6860001
The problem is that the coolbar i m using is downloaded from:
http://vbaccelerator.com/codelib/comctl/retbar.htm

i dont know how to get the heights of all bands.
0

Accepted Solution

segan earned 150 total points
ID: 6860067
Hi Nelson,

Its nothing but ScaleHeight and ScaleWidth properties.

Selva.
0

LVL 1

Author Comment

ID: 6863116
i think ScaleHeight is the correct property. But the it seems that ScaleHeight does not return me correct inner width of the MDI.

It may due to the 3rd party coolbar i m using. i m trying to find the height of each band and do a calculations.
0

Expert Comment

ID: 6864026

Public Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long

Public Const SM_CYCAPTION = 4

SM_CYCAPTION: Returns the MDI-Form Caption height

Now as you have coolbar and status bar : put the following code in the MDIForm_Load:

dim lTotal as long

lTotal = me.height - GetSystemMetrics(SM_CYCAPTION) -  (GetSystemMetrics(SM_CYMENU) * 2)  ' Multiply by two coz you have 2 floating objects (Status bar and cool bar)on the MDI from, if more do the appropriate.

So that lTotal will have the exact inner height of the MDI form.

For width Subtract the appropriate controls width from the me.width.
Thanks and kind regards.
0

LVL 1

Author Comment

ID: 6866851
After i double check my code, i found that segan's method "ScaleHeight and Width" works. Simple and direct. However, thanks all great idea. Especially GuruVB, your idea is quite brilliant to me.
0

## Featured Post

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
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…
###### Suggested Courses
Course of the Month8 days, 11 hours left to enroll