c#winform listview设置每项的间距

代码如下:

[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)]
        private static extern Int32 SendMessage(IntPtr hwnd, Int32 wMsg, Int32 wParam, Int32 lParam);

        const int LVM_FIRST = 0x1000;
        const int LVM_SETICONSPACING = LVM_FIRST + 53;

        /// <summary>
        /// 设置图标间隔
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        public void SetSpacing(Int16 x, Int16 y)
        {
            SendMessage(this.lvZhuType.Handle, LVM_SETICONSPACING, 0, x * 65536 + y);
            this.lvZhuType.Refresh();
        }

 

posted @ 2017-08-07 17:00  沉迷编程的程序员  阅读(2965)  评论(0编辑  收藏  举报