|
-
May 6th, 2001, 01:18 AM
#1
Thread Starter
Member
Titlebar height
I have been pulling my hair out with this one for a while now. I am resizing a form based on the top + height of the bottom most control on a form. Something like:
form1.height = Text18.top + Text18.height
if you try this you'll see that it doesn't display all of Text18. I know that this is due to the height of the titlebar being included in the height of the form but not in the top property of the text box. So this brings me to either having to do something like:
form1.height = Text18.top + Text18.height + 500
the 500 is to make up for the titlebar height, however this isn't the real height of the titlebar and titlebar heights can change from system to system, so what I really need to do is something more like:
form1.height = Text18.top + Text18.height + Titlebar.height
Titlebar unfortunatly isn't an object though and hence doesn't have a height property so I need some way of getting the titlebar height in either twips or pixels, twips would be better but I can convert between them. So if you know of a way to get the Titlebar height or some other way of coping with this I would really appreciate it if you would help me out with the code.
Thanks in advance.
Matt Bradbury
An optimist will claim the glass is half full.
A pessimist that it is half empty.
I just think the glass is too big.
-
May 6th, 2001, 02:00 AM
#2
If the scalemode of the form is in twips, you can get the height of the titlebar by subtracting the scale height from the actual height. If it isn't in twips, and it is in pixels, multiply the scale height by Screen.TwipsPerPixelY before subtracting it from the actual height.
Code:
Dim lngCHeight As Long
Me.ScaleMode = vbTwips
lngCHeight = Me.Height - Me.ScaleHeight
-
May 6th, 2001, 02:09 AM
#3
Thread Starter
Member
you da man!!!!!! thanks Dreamlax
Matt Bradbury
An optimist will claim the glass is half full.
A pessimist that it is half empty.
I just think the glass is too big.
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
|