Print Page | Close Window

Calculating CommandBar Height

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=401
Printed Date: 23 November 2024 at 10:43am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Calculating CommandBar Height
Posted By: MikeV
Subject: Calculating CommandBar Height
Date Posted: 30 January 2004 at 11:47pm

I know this was asked before by someone else but I didn't understand the answer, so let me try again:

My problem is I need to position a tabstrip right below the where ever the CommandBar ends (since the system font can affect the CommandBar height)

I would assume the solution is something like:

for i = 0 to CommandBar.Count

CommandBar(i).GetWindowRect lLeft, lTop, lRight, lBottom

lTotalHeight = lTotalHeight + (lBottom - lTop)

next i

My problem is; 1) I'm not getting any value returned in the variables I pass, and 2) Even if I did get a value would it represent Twips?  If it's not twips what is it and how do i convert it to something I can work with?

I looked through all the samples and didnt' see an example of this.  Can someone (or Oleg ) post an example?

Thanks




Replies:
Posted By: Boyd
Date Posted: 31 January 2004 at 8:57am

You should place the following code in the Form_Resize event:

    Dim Left As Long, Top As Long, Right As Long, Bottom As Long
    CommandBars.GetClientRect Left, Top, Right, Bottom

These variable will determine the boundary of the client area that is not being used by the CommandBars.  Keep in mind that the bars can be docked to the left, right, and bottom, so getting the height isn't all you have to know.  I may be mistaken, but I beleive the values are returned in your current scale mode (Twips by default).

Now that you have this code, you can position your tabstrip.

    TabStrip.Move Left + 1, Top + 1, Right - Left - 2

This will give your tabstrip the proper Top, Left, and Width.  Height is left unmodified.

Hope this helps!




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net