如何更改 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);
}
关于c# - 更改 ListView 的背景选择颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2530342/