Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Obtain the width and height of MDI (inner area)

Posted on 2002-03-13
6
Medium Priority
?
693 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 54

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 150 total points
ID: 6860067
Hi Nelson,

Its nothing but ScaleHeight and ScaleWidth properties.

Selva.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

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 designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
Suggested Courses

916 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