mirror of
https://github.com/mirror/processhacker
synced 2026-06-08 16:03:24 +00:00
85e3d48e8c
git-svn-id: svn://svn.code.sf.net/p/processhacker/code@2061 21ef857c-d57f-4fe0-8362-d861dc6d29cd
40 lines
1.4 KiB
C#
40 lines
1.4 KiB
C#
// Supports two blog entries by Daniel Moth:
|
|
// http://www.danielmoth.com/Blog/2007/01/treeviewvista.html
|
|
// AND
|
|
// http://www.danielmoth.com/Blog/2006/12/tvsexautohscroll.html
|
|
|
|
using System.Runtime.InteropServices;
|
|
using ProcessHacker.Native.Api;
|
|
using System;
|
|
|
|
public class VistaTreeView : System.Windows.Forms.TreeView
|
|
{
|
|
public const int TV_FIRST = 0x1100;
|
|
public const int TVM_SETEXTENDEDSTYLE = TV_FIRST + 44;
|
|
public const int TVM_GETEXTENDEDSTYLE = TV_FIRST + 45;
|
|
public const int TVM_SETAUTOSCROLLINFO = TV_FIRST + 59;
|
|
public const int TVS_EX_AUTOHSCROLL = 0x0020;
|
|
public const int TVS_EX_FADEINOUTEXPANDOS = 0x0040;
|
|
public const int GWL_STYLE = -16;
|
|
|
|
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
|
|
internal static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
|
|
|
|
protected override void OnHandleCreated(System.EventArgs e)
|
|
{
|
|
base.OnHandleCreated(e);
|
|
|
|
// get style
|
|
int dw = SendMessage(this.Handle, TVM_GETEXTENDEDSTYLE, 0, 0);
|
|
|
|
// Update style
|
|
dw |= TVS_EX_AUTOHSCROLL; // autoscroll horizontaly
|
|
dw |= TVS_EX_FADEINOUTEXPANDOS; // auto hide the +/- signs
|
|
|
|
// set style
|
|
Win32.SendMessage(this.Handle, (WindowMessage)TVM_SETEXTENDEDSTYLE, 0, dw);
|
|
|
|
// little black/empty arrows and blue highlight on treenodes
|
|
Win32.SetWindowTheme(this.Handle, "explorer", null);
|
|
}
|
|
} |