ListView标题外观平坦

时间:2015-01-21 14:03:18

标签: .net vb.net winforms

我希望你们都很好并且做得很好。 我在listview中面临一个问题。我有一些标题是listview,它们看起来很扁平,而不是根据windows 7主题。 请注意附加图片。enter image description here

2 个答案:

答案 0 :(得分:0)

由于您从Sub Main启动应用程序,因此您没有使用自动启用视觉样式的VB“应用程序框架”。这很容易解决:

Public Sub Main()
    ' use this before any WinForms elements are 
    ' created or referenced!
    Application.EnableVisualStyles()        ' to add

    '... your other code

    Application.Run(New MainForm)            ' start up form

End Sub

答案 1 :(得分:0)

为什么这些问题的答案总是涉及Application.Run()?不需要它。 DoEvents也不是。Option Strict Public Module EntryPoint Public Sub Main() 'Optional, if you want the Vista/Windows7 theme on your controls Application.EnableVisualStyles() 'Show a form dim response As New MyCustomPack Using form As New MyCustomForm(response) form.ShowDialog() End Using 'Do something with the response System.Windows.Forms.MessageBox.Show(String.Format("The response is {0}", response.Value)) 'The program now ends End Sub End Module Public Class MyCustomForm Inherits System.Windows.Forms.Form Private WithEvents _CtrBtnChoice1 As System.Windows.Forms.Button = Nothing Private WithEvents _CtrBtnChoice2 As System.Windows.Forms.Button = Nothing Private _Response As MyCustomPack = Nothing Public Sub New(ByRef Out_Response As MyCustomPack) _Response = Out_Response End Sub Private Sub Form_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load 'Setup form controls here _CtrBtnChoice1 = New System.Windows.Forms.Button _CtrBtnChoice2 = New System.Windows.Forms.Button With _CtrBtnChoice1 'Set button size, location, text, etc End With With _CtrBtnChoice2 'Set button size, location, text, etc End With End Sub Private Sub _CtrBtnChoice1_Click(sender As Object, e As System.EventArgs) Handles _CtrBtnChoice1.Click _Response.Value = 11111 Me.Close() End Sub Private Sub _CtrBtnChoice2_Click(sender As Object, e As System.EventArgs) Handles _CtrBtnChoice2.Click _Response.Value = 22222 Me.Close() End Sub End Class Public Class MyCustomPack Public Value As Integer End Class 。以下是以Sub Main()开头的实用表单应用程序的基础。它涉及一个用户设计的表单,该表单被实例化并显示,并且在表单关闭后,利用pack对象将所述表单的响应发送回调用子例程。

{{1}}