habe ich XP Stile indem Sie die folgenden Imports und Modifizieren der Konstruktor (New Unterprogramm) für Form1 in Windows 10 und Visual Studio 2015 arbeiten:
Imports System.Windows.Forms.VisualStyles
Public Sub New()
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
Application.VisualStyleState = VisualStyleState.NoneEnabled
End Sub
Wenn Sie, warum die obige Lösung erfahren möchten die Wie es ist, dann sollten Sie versuchen, das MSDN-Beispiel unten zu sehen, das ich ändern musste, um es zu starten. Zuerst in VS ein neues Projekt zu machen, ein Form1, um es hinzuzufügen, und dann den gesamten Code unten in Form1 des Code einfügen:
Imports System
Imports System.Drawing
Imports System.Windows.Forms
Imports System.Windows.Forms.VisualStyles
Public Class Form1
Inherits Form
Private WithEvents button1 As New Button()
Private radioButton1 As New RadioButton()
Private radioButton2 As New RadioButton()
Private radioButton3 As New RadioButton()
Private radioButton4 As New RadioButton()
Public Sub New()
With button1
.AutoSize = True
.Location = New Point(10, 10)
.Text = "Update VisualStyleState"
End With
With radioButton1
.Location = New Point(10, 50)
.AutoSize = True
.Text = "Apply styles to client area only"
End With
With radioButton2
.Location = New Point(10, 70)
.AutoSize = True
.Text = "Apply styles to nonclient area only"
End With
With radioButton3
.Location = New Point(10, 90)
.AutoSize = True
.Text = "Apply styles to client and nonclient areas"
End With
With radioButton4
.Location = New Point(10, 110)
.AutoSize = True
.Text = "Disable styles in all areas"
End With
Me.Text = "VisualStyleState Test"
Me.Controls.AddRange(New Control() {button1, radioButton1,
radioButton2, radioButton3, radioButton4})
End Sub
<STAThread()>
Shared Sub Main()
Application.EnableVisualStyles()
Application.Run(New Form1())
End Sub
Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) _
Handles button1.Click
If radioButton1.Checked Then
Application.VisualStyleState =
VisualStyleState.ClientAreaEnabled
ElseIf radioButton2.Checked Then
Application.VisualStyleState =
VisualStyleState.NonClientAreaEnabled
ElseIf radioButton3.Checked Then
Application.VisualStyleState =
VisualStyleState.ClientAndNonClientAreasEnabled
ElseIf radioButton4.Checked Then
Application.VisualStyleState =
VisualStyleState.NoneEnabled
End If
' Repaint the form and all child controls.
Me.Invalidate(True)
End Sub
Zur Laufzeit, klicken Sie einfach auf die verschiedenen Optionsfelder, gefolgt von der Button1 klicken, und Sie werden sehen, dass sich der Client (Grenze) und Nicht-Client (innere Kontrollen) danach ändern.