Master_T
Master_T

Reputation: 8007

Windows Forms form doesn't look native

I've added a Windows Forms form to a VB.net application, and I'm showing it with the usual:

Dim form As New FormInsCapiLettore()
form.ShowDialog()

The problem is that the form, when shown, has an incredibly ugly "windows 95" style. Basically the system theme (Windows 10 in my case) does not get applied. The result is in the screenshot below:

enter image description here

As you can see, not only does it look ugly and non-native, but the layout also screws up: notice the TextBox spilling outside the "input" GroupBox and the "Fine" Button not filling the vertical space. Notice that the form looks absolutely fine in the Visual Studio designer, with the native look! But when launched, the form has no theme and looks like the screenshot.

Any clues? Additional info: Running Windows 10 x64 Visual Studio 2015 Application compiled against .NET 4.0

Upvotes: 1

Views: 6935

Answers (1)

SLaks
SLaks

Reputation: 888203

You need to call Application.EnableVisualStyles().

Upvotes: 9

Related Questions