【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);
        }
    }
}

 

posted @ 2016-09-30 10:12  发明创造小能手  阅读(821)  评论(0编辑  收藏  举报
levels of contents