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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM