Finding out the Height of a set of commandbars
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=4548
Printed Date: 05 November 2025 at 10:46am Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com
Topic: Finding out the Height of a set of commandbars
Posted By: fernando
Subject: Finding out the Height of a set of commandbars
Date 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
|
Replies:
Posted By: cj_user
Date Posted: 22 September 2006 at 2:19pm
|
Hi Fernando -- did u manage to find a solution to this?
|
Posted By: fernando
Date Posted: 22 September 2006 at 2:41pm
Hi,
NO sorry, I actually gave up. :(
|
Posted By: Waescher
Date 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...
|
|