|
-
Mar 17th, 2003, 05:03 PM
#1
Thread Starter
Addicted Member
Large font (Need your opinion)
Hey All,
My app, like most others, gets all screwed up if the user has
Large Fonts (Properties - Settings - Advanced) selected. I have
spent the better part of a day looking for a solution...and I
found one.
What I need to know is if it works for the rest of you. I have
Windows 98, and it seems to work just fine.
You will need to check what the Screen.TwipsPerPixelX, and
Screen.TwipsPerPixelY is. I did this by using the following
in a different form.
Private Sub Form_Load()
Label1.Caption = Screen.TwipsPerPixelX
Label2.Caption = Screen.TwipsPerPixelY
End Sub
Once you know (mine was 15 for 800x600), just change the
setting in the code below...
********************************************
'Just paste all of this in a module
Public Const DesignTimeXFactor = 15 'Set to whatever Screen.TwipsPerPixelX is at design time
Public Const DesignTimeYFactor = 15 'Set to whatever Screen.TwipsPerPixelY is at design time
Public sglRunTimeX As Single, sglRunTimeY As Single
Sub Main()
sglRunTimeX = (Screen.TwipsPerPixelX) / DesignTimeXFactor
sglRunTimeY = (Screen.TwipsPerPixelY) / DesignTimeYFactor
If sglRunTimeX <> 1 Or _
sglRunTimeY <> 1 Then
AlignStuff Form1
Else
'MsgBox "Alignment Not Required..." & vbNewLine & "Thank You Anyways", vbOKOnly, "*grin*"
AlignStuff Form1
End If
Form1.Show
End Sub
Public Function AlignStuff(frmForm As Form)
Dim ctl As Control
On Error Resume Next
frmForm.Width = frmForm.Width * sglRunTimeX
frmForm.Height = frmForm.Height * sglRunTimeY + 10 'I added this (+ 10)
For Each ctl In frmForm.Controls
ctl.Left = ctl.Left * sglRunTimeX
ctl.Top = ctl.Top * sglRunTimeY
ctl.Width = ctl.Width * sglRunTimeX
ctl.Height = ctl.Height * sglRunTimeY
********************************************
Remember to select Sub Main as the Startup Object from the
project properties screen.
Thanks a lot in advance,
Rron
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
|