Reputation: 16839
In uTorrent 2.2 when a treeview node is selected, the node has a similar appearance of a button. It makes the .NET treeview control seem like so inadequate to me. Now I know utorrent is written in C++, but does anyone know how they might have done this, or does anybody know of libraries out there that would suffice?
Upvotes: 3
Views: 861
Reputation: 941744
It is a standard Windows TreeView control with the Win7 "Explorer" visual style applied. You can get one in your own program easily by changing the theme for the control. Add a new class to your project and paste the code shown below. Compile. Drop the new control from the top of the toolbox onto your form.
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);
}
This isn't directly possible for WPF unless you use the WindowsFormHost class.
Upvotes: 4