|
-
Mar 22nd, 2004, 07:46 PM
#1
Thread Starter
Hyperactive Member
XP style vs 98 [resolved]
I have a major problem that i've had to overlook in many of my projects. If the program has a frame, and on load I want to make the size of the form the size of the frame with equal margin. Well with XP style i set the margins manually and it works, but when I change the style to win 98, the margin is no longer equal, especial with the height properties. Is there a function, API, etc to determine exact size of the borders so I could resize my form in any style and still get the same margins all around? Scalewidth doesn't really help the way i use it but i might be using it in a wrong way. Thanks.
Last edited by Dmitri K; Mar 23rd, 2004 at 07:39 PM.
-
Mar 23rd, 2004, 05:48 PM
#2
Thread Starter
Hyperactive Member
-
Mar 23rd, 2004, 06:25 PM
#3
Hyperactive Member
look up the SystemMetrics API
cjqp
When your answer is the Arc Sin of 1.015, you should check your Pythagorean triple.
-
Mar 23rd, 2004, 07:39 PM
#4
Thread Starter
Hyperactive Member
They have almost no information that I could find about that API but I decided to write my own function to get border size. Although I'm sure many have already used this, but I think it's nice to have because I guess not as many people know as I thought; well my post was answered. Anyway, here's the code
VB Code:
Option Explicit
Private Type T_Borders
L As Long 'left
R As Long 'right
T As Long 'top
B As Long 'bottom
End Type
Public B As T_Borders
Public Sub GetBorders(frm As Form)
Dim horiz_d As Long
Dim vertical_d As Long
horiz_d = (frm.Width - frm.ScaleWidth) / 2
vertical_d = (frm.Height - frm.ScaleHeight) - horiz_d 'bottom is the same size as sides
B.L = horiz_d
B.R = horiz_d
B.T = vertical_d
B.B = horiz_d
End Sub
-
Mar 23rd, 2004, 09:24 PM
#5
See if this works for you as well:
VB Code:
Option Explicit
Const SM_CXBORDER = 5
Const SM_CYBORDER = 6
Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
Private Sub Command1_Click()
Debug.Print "Side Border: " & Str$(GetSystemMetrics(SM_CXBORDER)) * Screen.TwipsPerPixelX
Debug.Print "Bottom Border: " & Str$(GetSystemMetrics(SM_CYBORDER)) * Screen.TwipsPerPixelY
End Sub
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
|