0

I am writing in vb.net (2013). My form looks different in the IDE than in run-time when using Windows 10. I tried using the EnableVisualStyles command with no apparent success.

The first picture shows the form in my IDE, the second shows the form in run-time compared to the form using the EnableVisualStyle command.

I appreciate any help you can give.

Thanks!

Form in IDE

Forms with and without EnableVisualStyles

Below is the code for the form with EnableVisualStyles:

Imports System
Imports System.Drawing
Imports System.Windows.Forms 

'Summary description for Form1.
Public Class vsForm

    Inherits System.Windows.Forms.Form

    Private button1 As System.Windows.Forms.Button

    <System.STAThread()> _
    Public Shared Sub Main()

        System.Windows.Forms.Application.EnableVisualStyles()
        System.Windows.Forms.Application.Run(New Form1)
    End Sub 'Main

    Public Sub New()

        Me.button1 = New System.Windows.Forms.Button()
        Me.button1.Location = New System.Drawing.Point(24, 16)
        Me.button1.Size = New System.Drawing.Size(120, 100)
        Me.button1.FlatStyle = FlatStyle.System
        Me.button1.Text = "I am themed."

        ' Sets up how the form should be displayed and adds the controls to the form.
        Me.ClientSize = New System.Drawing.Size(300, 286)
        Me.Controls.Add(Me.button1)

        Me.Text = "Application.EnableVisualStyles Example"
        Me.FormBorderStyle = Windows.Forms.FormBorderStyle.Fixed3D
    End Sub 'New 
End Class 'Form1
procreator
  • 11
  • 1
  • If you are referring to the loss of the rounded form border, please explicitly state so. There is an API call that can be issued to force the old style. – TnTinMn Jun 30 '17 at 22:14
  • None of the border styles I try to apply seem to have any effect. I do prefer the rounded style, however. – procreator Jul 03 '17 at 13:45
  • Comment to Hans - Can you provide a link to the document that you feel this one is an exact duplicate of? Thanks! – procreator Jul 03 '17 at 13:47

0 Answers0