Windows 7 Native Look for .NET ListView

前端 未结 1 1645
夕颜
夕颜 2021-01-26 13:02

Currently, my ListViews look like this:

\"enter

How can I achieve that Windows 7 n

相关标签:
1条回答
  • 2021-01-26 13:20

    This was answered here: How to get Windows native look for the .NET TreeView?

    The given solution works for both for the ListView and the 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);
        }
    }
    
    0 讨论(0)
提交回复
热议问题