📄 cgradientlistview.cs
字号:
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace SmartWKN
{
/// <summary>
/// display a Listview with gradient background style
/// </summary>
public class cGradientListview
{
public cGradientListview()
{
}
[DllImport("coredll.dll")]
public static extern IntPtr GetCapture();
[DllImport("coredll.dll")]
private static extern int SendMessage(IntPtr hWnd, uint Msg, int wParam, int lParam);
const int LVS_EX_GRADIENT = 0x20000000;
const int LVM_SETEXTENDEDLISTVIEWSTYLE = 0x1000 + 54;
public static void SetGradient(ListView listView)
{
//Get a list view handle
listView.Capture = true;
IntPtr hList = GetCapture();
//Apply extended style
SendMessage(hList, (uint)LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_GRADIENT);
listView.Capture = false;
listView.Refresh();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -