【Wince-ListView】Wince中的 ListView怎么显示网格?

using System.Runtime.InteropServices;
using System.Windows.Forms;

namespace CETEST
{
    public class Common
    {

        private const int LVM_GETEXTENDEDLISTVIEWSTYLE = 0x1037;
        private const int LVM_SETEXTENDEDLISTVIEWSTYLE = 0x1036;
        private const int LVS_EX_GRIDLINES = 0x1;

        [DllImport("coredll.dll")]
        private static extern int SendMessageW(int hWnd, int wMsg, int wParam, int lParam);

        [DllImport("coredll.dll")]
        private static extern int GetFocus();

        public static void SetGridLines(ListView lvw)        {
            lvw.Focus();
            int hWnd = GetFocus();
            int extendedStyle = SendMessageW(hWnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);
            extendedStyle |= LVS_EX_GRIDLINES;
            SendMessageW(hWnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, extendedStyle);
        }
    }
}
原文地址:https://www.cnblogs.com/Sukie-s-home/p/5922883.html