Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - Finding out the Height of a set of commandbars
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Finding out the Height of a set of commandbars

 Post Reply Post Reply
Author
Message
fernando View Drop Down
Groupie
Groupie
Avatar

Joined: 22 May 2006
Status: Offline
Points: 25
Post Options Post Options   Thanks (0) Thanks(0)   Quote fernando Quote  Post ReplyReply Direct Link To This Post Topic: Finding out the Height of a set of commandbars
    Posted: 06 July 2006 at 1:47pm
Hi,

I have a CommandBars object inside a pictureBox. The commandBars has 3 commandBar objects inside and some of them wrap, thus increasing the height.

I'd like to know the total height occupied by the 3 commandBar objects, so I can resize the containing pictureBox accordingly.

How can I do this?

Thanks
Back to Top
cj_user View Drop Down
Newbie
Newbie


Joined: 14 August 2006
Status: Offline
Points: 23
Post Options Post Options   Thanks (0) Thanks(0)   Quote cj_user Quote  Post ReplyReply Direct Link To This Post Posted: 22 September 2006 at 2:19pm
Hi Fernando -- did u manage to find a solution to this?
Back to Top
fernando View Drop Down
Groupie
Groupie
Avatar

Joined: 22 May 2006
Status: Offline
Points: 25
Post Options Post Options   Thanks (0) Thanks(0)   Quote fernando Quote  Post ReplyReply Direct Link To This Post Posted: 22 September 2006 at 2:41pm
Hi,

NO sorry, I actually gave up. :(
Back to Top
Waescher View Drop Down
Newbie
Newbie


Joined: 15 September 2006
Location: Germany
Status: Offline
Points: 27
Post Options Post Options   Thanks (0) Thanks(0)   Quote Waescher Quote  Post ReplyReply Direct Link To This Post Posted: 08 November 2006 at 10:06am
Hey fernando,
this seems to by pretty easy!


You need to know the CommandBar(s) which height is needed
Take a look at this function:


Private Function getCommandbarHeight(ByVal oBar As CommandBar) As Long
    ' It seems to be necessary to recalc the position if more than one CommandBarHeight is requested
    cmbCommandbarControl.RecalcLayout
    ' Calc
    Call oCommandBar.GetWindowRect(lLeft, lTop, lRight, lBottom)
    ' Result
    getCommandbarHeight = lBottom - lTop
End Function


Now, you've got the height of this CommandBar
In your case there are more than one CommandBars - just add the height of the second Bar...


Private Function getTotalHeight as Long
dim lHeight as Long

    ' Calc
    lHeight = getCommandbarHeight(... BAR1 ...)
    lHeight = lHeight + getCommandbarHeight(...BAR2...)
    lHeight = lHeight +getCommandbarHeight(... BAR3 ...)
    ' ...
   
    ' Result
    getTotalHeight = lHeight
End Function



If you want to calc the height of the Top-Menubar then call this method
...
    lheight = getCommandbarHeight(cmbCommandbarControl.ActiveMenuBar)
...


Hope this helps!
Greetings...

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.031 seconds.