在uTorrent 2.2中,当选择树视图节点时,该节点具有类似于按钮的外观。这使得.NET的树视图控件在我看来是不够用的。现在我知道utorrent是用C++写的,但是有没有人知道他们是怎么做到的,或者有没有人知道那里有足够的库?

发布于 2010-12-09 05:19:55
它是一个应用了Win7“资源管理器”视觉样式的标准控件。通过更改控件的主题,您可以在自己的程序中轻松获得一个。向您的项目添加一个新类,并粘贴如下所示的代码。编译。将新控件从工具箱顶部拖放到窗体上。
using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;
class MyTreeView : TreeView {
protected override void OnHandleCreated(EventArgs e) {
if (Environment.OSVersion.Version.Major >= 6) {
SetWindowTheme(this.Handle, "Explorer", null);
}
base.OnHandleCreated(e);
}
[DllImportAttribute("uxtheme.dll", CharSet = CharSet.Auto)]
private static extern int SetWindowTheme(IntPtr hWnd, string appname, string idlist);
}除非您使用WindowsFormHost类,否则这对于WPF来说是不可能的。
https://stackoverflow.com/questions/4392147
复制相似问题