![]() |
Finding out the Height of a set of commandbars |
Post Reply ![]() |
Author | |
fernando ![]() Groupie ![]() ![]() Joined: 22 May 2006 Status: Offline Points: 25 |
![]() ![]() ![]() ![]() ![]() 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 |
|
![]() |
|
cj_user ![]() Newbie ![]() Joined: 14 August 2006 Status: Offline Points: 23 |
![]() ![]() ![]() ![]() ![]() |
Hi Fernando -- did u manage to find a solution to this?
|
|
![]() |
|
fernando ![]() Groupie ![]() ![]() Joined: 22 May 2006 Status: Offline Points: 25 |
![]() ![]() ![]() ![]() ![]() |
Hi,
NO sorry, I actually gave up. :( |
|
![]() |
|
Waescher ![]() Newbie ![]() Joined: 15 September 2006 Location: Germany Status: Offline Points: 27 |
![]() ![]() ![]() ![]() ![]() |
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... |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |