Solved

Obtain the width and height of MDI (inner area)

Posted on 2002-03-13
6
677 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
[X]
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
6 Comments
 
LVL 52

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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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: 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.

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…
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 process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses
Course of the Month11 days, 14 hours left to enroll

623 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