Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - Calculating CommandBar Height
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Calculating CommandBar Height

 Post Reply Post Reply
MikeV View Drop Down

Joined: 03 January 2004
Location: United States
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote MikeV Quote  Post ReplyReply Direct Link To This Post Topic: Calculating CommandBar Height
    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?


Back to Top
Boyd View Drop Down
Senior Member
Senior Member

Joined: 08 December 2003
Location: United States
Status: Offline
Points: 285
Post Options Post Options   Thanks (0) Thanks(0)   Quote Boyd Quote  Post ReplyReply Direct Link To This Post 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!

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.047 seconds.