代码如下:
[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(); }