.net ListView标题外观平面

.net ListView标题外观平面,.net,vb.net,winforms,.net,Vb.net,Winforms,我希望你们都很好,做得很好。 我在listview中面临一个问题。我有一些标题是listview,它看起来很平淡,不符合Windows7的主题。 请查看附加图片。由于您是从子主目录启动应用程序的因此您没有使用自动启用视觉样式的VB“应用程序框架”。这很容易解决: Public Sub Main() ' use this before any WinForms elements are ' created or referenced! Application.Enable

我希望你们都很好,做得很好。 我在listview中面临一个问题。我有一些标题是listview,它看起来很平淡,不符合Windows7的主题。
请查看附加图片。

由于您是从
子主目录启动应用程序的
因此您没有使用自动启用视觉样式的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

为什么这些问题的答案总是涉及到
Application.Run()
?不需要。两个都不是
DoEvents
。以下是从Sub Main()开始的实用表单应用程序的基础。它涉及一个用户设计的表单,该表单被实例化和显示,并且一旦表单关闭,利用一个pack对象将响应从所述表单发送回调用子例程

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

看起来似乎未启用视觉样式。这是C#还是VB?在VB上。而且在一张表格上也不是这样。这是因为
EnableVisualStyles
Application
的成员,所以它会影响所有表单。你的应用程序是从主窗体还是从子窗体开始的?它从Main()开始意味着,我为此创建了一个模块,并从该模块运行我的应用程序。模块包含main()非常感谢大家。您的回答中有一些细微的修改@puropoix。我们还必须调用applcation.DoEvents()。我的大多数应用程序都是从Sub-Main开始的,我从来不用使用
DoEvents
(永远)。在您的案例中,可能还有其他需要的东西在起作用
DoEvents
几乎从来都不是一个好主意……但很高兴它奏效了!是的,可能是,因为我也在使用devexpress控件。请确保在Sub-main中非常、非常早地调用它,并且没有DoEvents也应该可以。是的,现在可以很早地调用它。非常感谢你对我的帮助。