|
-
Oct 16th, 2000, 04:03 AM
#1
Thread Starter
Junior Member
Does anybody know an API function that returns the depth of a form's title bar. (with different display settings the depth of the title bar changes).
If not is there another way to work this out.
Any help would really be appreciated.
-
Oct 16th, 2000, 06:03 AM
#2
You can calculate it by useing the forms height and width and the scale height en width
The scale.... gives the size of the client area
Example:
Code:
Private Function FormBorderWidth(ByVal frm As Form) As Long
'Form width is the complete width of the form
'Form scalewidth is the width of the client area of the form(the useable area)
'Substracting the scale witdth from the width gives the total width of the _
'non client area(borders) devide this by 2 to get the width of the individual _
'borders
FormBorderWidth = (frm.Width - frm.ScaleWidth) / 2
End Function
Private Function FormTitlebarHeight(ByVal frm As Form) As Long
'Height - scaleheight, get total non client height
'Substract 1 borderwidth (height of the bottom border)
FormTitlebarHeight = (frm.Height - frm.ScaleHeight) - FormBorderWidth(frm)
End Function
Call it like this:
Debug.Print "Border Width: " & FormBorderWidth(Me)
Debug.Print "Titlebar Height: " & FormTitlebarHeight(Me)
-
Oct 16th, 2000, 06:22 AM
#3
Thread Starter
Junior Member
Thanks Azzmodan
I will give that a go.
-
Oct 16th, 2000, 09:11 AM
#4
transcendental analytic
What about different scalemodes? And especially user, it will change from case to case. Well Azzmodan you could have this, it works for all scalemodes 
Code:
Private Function FormBorderWidth(ByVal frm As Form) As Long
'Form width is the complete width of the form
'Form scalewidth is the width of the client area of the form(the useable area)
'Substracting the scale witdth from the width gives the total width of the _
'non client area(borders) devide this by 2 to get the width of the individual _
'borders
FormBorderWidth = (frm.Width - frm.ScaleX(frm.ScaleWidth, frm.ScaleMode, vbTwips)) / 2
End Function
Private Function FormTitlebarHeight(ByVal frm As Form) As Long
'Height - scaleheight, get total non client height
'Substract 1 borderwidth (height of the bottom border)
FormTitlebarHeight = (frm.Height - ScaleY(frm.ScaleHeight, frm.ScaleMode, vbTwips)) - FormBorderWidth(frm)
End Function
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Oct 16th, 2000, 09:57 AM
#5
Aah yes, i posted a sample from one of my old modules.
I'll pay attention to what i post next time =]
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
|