|
-
May 14th, 2004, 09:42 AM
#1
Thread Starter
pathfinder
[Rslvd:Thnx 2 Mendhak,Crptcblade] How do I find the Height of the Titlebar of a Form?
When placing controls dynamically on a form, I'd like to resize the form to be a certain amount more than the bottom edge of the bottom control placed on the form. However, its the same old problem, the vertical position of a control does not include the height of the titlebar of the form, so saying something like:
VB Code:
Me.Size = New Size(New Point(Me.Width, mybuttons(255).Bottom + mybuttons(255).Height))
still cuts off the control array.
-Lou
Last edited by NotLKH; May 14th, 2004 at 10:36 AM.
-
May 14th, 2004, 10:10 AM
#2
I think it's a constant of 25. But I don't know what it'd be if you had XP styles in there.
-
May 14th, 2004, 10:13 AM
#3
Try SystemInformation.CaptionHeight
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
May 14th, 2004, 10:15 AM
#4
Originally posted by crptcblade
Try SystemInformation.CaptionHeight
I learn something new every day.
-
May 14th, 2004, 10:18 AM
#5
Not me. I just forget stuff I used to know.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
May 14th, 2004, 10:22 AM
#6
Thread Starter
pathfinder
Originally posted by mendhak
I think it's a constant of 25. But I don't know what it'd be if you had XP styles in there.
Nope! No XP Styles. {Hmmm, Now you've got me thinking about how to do that.}
However, it seems that 25 is a good guesstimate.
I don't know why, but you inspired me to check out the "hidden" area of the forms code, came across "clientsize", and so I added the following to my load event:
VB Code:
MyExtra = Me.Size.Height - Me.ClientSize.Height
and it turns out Msgboxing MyExtra reveals MyExtra = 27.
Which perfectly adjusts my forms size to just where I want it.
-Thanks
-Lou
-
May 14th, 2004, 10:28 AM
#7
Thread Starter
pathfinder
Originally posted by crptcblade
Try SystemInformation.CaptionHeight
Hmmm, it returns 19, a little too small compared to the 27 that MyExtra returns. Must be the height of the Hypothetical Label in the titlebar.
I'll just file this little tidbit away under "Things that might be handy."
now, lets see what other nifty little items are in this SystemInformation Dot Popup
-Lou
-
May 14th, 2004, 10:32 AM
#8
Originally posted by NotLKH
However, it seems that 25 is a good guesstimate.
See that, Joe!! I win!
-
May 14th, 2004, 10:35 AM
#9
Originally posted by NotLKH
Nope! No XP Styles. {Hmmm, Now you've got me thinking about how to do that.}
http://searchvb.techtarget.com/vsnet...293674,00.html
-
May 14th, 2004, 01:51 PM
#10
Hi.
Instead of trying to calculate the forms total height, you can just set the ClientSize.
So if you need a clientheight of e.g. 400, you would normally set it to about 425.
But instead just set Me.ClientSize=New Size(Me.Width,400)
Then VB will automatically set the "true" form size accordingly.
I wish I could think of something witty to put in my sig...
...Currently using VS2013...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|