0

我正在使用winForm。我正在尝试将 treeView 组件的主题更改为 windows 主题,我看到@David Heffernan 回答了此类问题:如何让 Windows 原生查找 .NET TreeView? 但我不完全理解。

我尝试了他的答案,它成功了一半:加号/减号更改为“三角形”节点句柄,蓝色常规方块更改为“气泡”选择方块,但它不会将文件夹/文件更改为 windows\explorer 图标。我需要在他的代码中添加什么才能使图标出现?

public class NativeTreeView : System.Windows.Forms.TreeView
{
    [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);
    }
}

所需格式

4

0 回答 0