cgradientlistview.cs

来自「一个pocketPC 程序」· CS 代码 · 共 39 行

CS
39
字号
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 + =
减小字号Ctrl + -
显示快捷键?