Windows 7 Native Look for .NET ListView

时间:2011-02-23 03:26:53

标签: .net windows listview themes

目前,我的ListViews看起来像这样:

enter image description here

如何在下面实现Windows 7本机外观?

enter image description here

1 个答案:

答案 0 :(得分:1)

这回答:How to get Windows native look for the .NET TreeView?

给定的解决方案适用于ListView和TreeView。

public class NativeListView : System.Windows.Forms.ListView
{
    [DllImport("uxtheme.dll", CharSet = CharSet.Unicode)]
    private extern static int SetWindowTheme(IntPtr hWnd, string pszSubAppName,
                                        string pszSubIdList);

    protected override void CreateHandle()
    {
        base.CreateHandle();

        SetWindowTheme(this.Handle, "explorer", null);
    }
}