Link to home
Start Free TrialLog in
Avatar of Karen Wilson
Karen WilsonFlag for United States of America

asked on

Labels overlap text fields in Windows Form

I have a windows form size set to 1024, 78.  I have a few users, that when they open this form, the labels overlap the text fields.  This user has a screen resolution of 1920 x 1080.  The view icon setting is at medium.  I have the code below in the form but nothing changed.  I have attached a picture of what is happening.  Any suggestions?

Dim rect As Rectangle = My.Computer.Screen.Bounds
        If rect.Width < 1024 OrElse rect.Height < 768 Then

            ' Put the form in the upper left corner
            Me.Location = New Point(0, 0)
            Dim widthRatio As Double = rect.Width / 1024

            ' Get the ratio of screen height : form's original height
            Dim heightRatio As Double = rect.Height / 768
            ' Determine which ratio is smaller, and use the dimension
            ' with the smaller ratio to calculate the dimension with the
            ' larger ratio.  This ensures that the dimension with the
            ' smaller ratio will not exceed the bounds of the screen.
            If widthRatio < heightRatio Then
                ' Width ratio is smaller, so set the form to take up the
                ' entire width of the screen, and set height based on
                ' desired 4:3 aspect ratio.
                Me.Width = rect.Width
                Me.Height = CInt(Me.Width * 3 / 4)
            Else
                ' Height ratio is smaller, so set the form to take up the
                ' entire height of the screen, and set width based on
                ' desired 4:3 aspect ratio.
                Me.Height = rect.Height
                Me.Width = CInt(Me.Height * 4 / 3)
            End If
        End If
finselect.jpg
Avatar of Brian Pringle
Brian Pringle
Flag of United States of America image

The user probably changed the font size in Windows to a larger size.  You could either have them change it back or hard-code your app's labels to be a specific font size.
Avatar of Karen Wilson

ASKER

It appears that they have the display set to medium 125%.  I will try to hard-code the labels and see what happens.
I checked my form and I already have the font set at Arial 8 for all my labels.  Can I change their computer display to the smaller default size?
You should not change their computer display. If they set it to 125%, it is because this is how they want to work and you can give them headaches if you start playing with that setting. On my Windows 8 tablet for instance, I have to leave the setting à 125% otherwise the desktop interface is useless.

You can try to play with different settings with the AutoScale mode of the form. This has worked for me in my last application.
I changed the autoscale mode to font and it remained the same for this user.  I'll keep changing it to see if I can get one to work.
You might also have an option saved in the users configuration, and loop through the controls on the form to set their Font at 6.5 or 6.75. With the 125% increase, they will come close to 8.
Sorry it took me so long to come back to this.  I got sent off to another project.  Changing the font to 6 on the labels didn't work either.  Anyone else have any suggestions?
ASKER CERTIFIED SOLUTION
Avatar of Karen Wilson
Karen Wilson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I searched the internet and found the AutoScale to DPI.