如何更改 ListView 上的选择颜色?默认情况下,当用户选择一个项目时,它会显示蓝色背景。我想把它改成深灰色,或者其他什么......
谢谢您的帮助!
如果你想要你的ListView
具有 Windows 资源管理器的风格ListView
(包括 Win7/Vista 中带有圆角边缘的漂亮外观),您可以使用一点 P/Invoke 来实现这一点:
[DllImport("uxtheme.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
internal static extern int SetWindowTheme(IntPtr hWnd, string appName, string partList);
// You can subclass ListView and override this method
protected override void OnHandleCreated(EventArgs e)
{
base.OnHandleCreated(e);
SetWindowTheme(this.Handle, "explorer", null);
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)