Wriar
Wriar

Reputation: 306

.NET Form Size Scaling Issues

I've created a small form in Visual Basic .NET. However, when opening the form, I've discovered that when the form's size have been set to a small size, like 67, 67, the form's window often becomes stretched.

I thought this was a high DPI scaling issue, as I'm using a high DPI screen, so I opened the application release file's Properties > Compatibility > Change High DPI settings and selected "Override High DPI scaling issues, scaling performed by Application" and I believed that it would solve the problem as usual.

However, I noticed that this did not fix the stretching of the form as I thought it would...

How can I fix this issue so that the actual form's size isn't stretched and reflects the form's size shown in the designer? There are some supplementary screenshots included below...

Designer:

Forms Designer

Form Properties:

Form Properties

Result from Debugging and Changing Compatibility Settings (Form Indicated by Blue Arrow) Result

Upvotes: 1

Views: 330

Answers (1)

Mathias Ovesen
Mathias Ovesen

Reputation: 91

Try setting the size in the form loading event. It worked for me.

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    Me.Size = New Size(67, 61)
End Sub

Upvotes: 1

Related Questions