Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Obtain the width and height of MDI (inner area)

Posted on 2002-03-13
6
670 Views
Last Modified: 2007-12-19
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
Comment
Question by:chnelson
6 Comments
 
LVL 51

Expert Comment

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

?
   
0
 
LVL 1

Author Comment

by:chnelson
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

by:
segan earned 50 total points
ID: 6860067
Hi Nelson,

Its nothing but ScaleHeight and ScaleWidth properties.

Selva.
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 1

Author Comment

by:chnelson
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

by:GuruVB
ID: 6864026
Please use Following API:

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

Public Const SM_CYCAPTION = 4
Public Const SM_CYMENU = 15

SM_CYCAPTION: Returns the MDI-Form Caption height
CYMENU: Returns the MDI Form  Menu 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.
I hope this will help you.
0
 
LVL 1

Author Comment

by:chnelson
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

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…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
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…

856 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