C# listview大图标之间的间距

[DllImport("user32.dll",CharSet = CharSet.Auto)]
public   static   extern   IntPtr   SendMessage(IntPtr   hWnd,   int   msg,   int   wParam,   int   lParam); 
private   int   LVM_SETICONSPACING   =   0x1035//把下面放到相应 form 的 form_Load 或者是 构造函数中,
SendMessage(this.listViewChart.Handle,   LVM_SETICONSPACING,   0,   0x10000   *   140   +   130);
//其中 140控制行距,130控制列距

public RadForm3()
        {
            InitializeComponent();
        }


        [DllImport("user32.dll",CharSet = CharSet.Auto)]
        public   static   extern   IntPtr   SendMessage(IntPtr   hWnd,   int   msg,   int   wParam,   int   lParam); 
        private   int   LVM_SETICONSPACING   =   0x1035; 
        //把下面放到相应 form 的 form_Load 或者是 构造函数中,




//其中 140控制行距,130控制列距


        private void RadForm3_Load(object sender, EventArgs e)
        {
            SendMessage(this.listView1.Handle,   LVM_SETICONSPACING,   0,   0x10000   *   100   +   100);
            for (int i = 0; i < 100; i++)
            {
                ListViewItem item = new ListViewItem();
                item.ImageIndex = 0;
                //item.Size = new Size(100, 100);
                listView1.Items.Add(item);
            }
        }

 

posted @ 2022-07-15 09:17  devgis  阅读(395)  评论(0编辑  收藏  举报