Results 1 to 3 of 3

Thread: Titlebar height

  1. #1

    Thread Starter
    Member RebelDev's Avatar
    Join Date
    Apr 2001
    Posts
    57

    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.

  2. #2
    Dreamlax
    Guest
    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

  3. #3

    Thread Starter
    Member RebelDev's Avatar
    Join Date
    Apr 2001
    Posts
    57
    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
  •  



Click Here to Expand Forum to Full Width