public void SetTileSize(Size size) { ListViewAPI.LVTILEVIEWINFO apiTileView; ListViewAPI.INTEROP_SIZE apiSize; this.SuspendLayout(); int param = 0; _apiRetVal = ListViewAPI.SendMessage((System.IntPtr) this.Handle, ListViewAPI.LVM_GETVIEW, ListViewAPI.LV_VIEW_TILE, ref param); if ((int)_apiRetVal != ListViewAPI.LV_VIEW_TILE) { return; } apiSize = new ListViewAPI.INTEROP_SIZE(); apiSize.cx = size.Width; apiSize.cy = size.Height; apiTileView = new ListViewAPI.LVTILEVIEWINFO(); apiTileView.cbSize = Marshal.SizeOf(typeof(ListViewAPI.LVTILEVIEWINFO)); apiTileView.dwMask = ListViewAPI.LVTVIM_TILESIZE | ListViewAPI.LVTVIM_LABELMARGIN; _apiRetVal = ListViewAPI.SendMessage(this.Handle, ListViewAPI.LVM_GETTILEVIEWINFO, 0, ref apiTileView); apiTileView.dwFlags = ListViewAPI.LVTVIF_FIXEDSIZE; apiTileView.sizeTile = apiSize; _apiRetVal = ListViewAPI.SendMessage(this.Handle, ListViewAPI.LVM_SETTILEVIEWINFO, 0, ref apiTileView); this.ResumeLayout(); }
public void SetTileSize(Size size) { ListViewAPI.LVTILEVIEWINFO apiTileView; ListViewAPI.INTEROP_SIZE apiSize; this.SuspendLayout(); int param = 0; _apiRetVal = ListViewAPI.SendMessage((System.IntPtr)this.Handle, ListViewAPI.LVM_GETVIEW, ListViewAPI.LV_VIEW_TILE, ref param); if ((int)_apiRetVal != ListViewAPI.LV_VIEW_TILE) { return; } apiSize = new ListViewAPI.INTEROP_SIZE(); apiSize.cx = size.Width; apiSize.cy = size.Height; apiTileView = new ListViewAPI.LVTILEVIEWINFO(); apiTileView.cbSize = Marshal.SizeOf(typeof (ListViewAPI.LVTILEVIEWINFO)); apiTileView.dwMask = ListViewAPI.LVTVIM_TILESIZE | ListViewAPI.LVTVIM_LABELMARGIN; _apiRetVal = ListViewAPI.SendMessage(this.Handle, ListViewAPI.LVM_GETTILEVIEWINFO, 0, ref apiTileView); apiTileView.dwFlags = ListViewAPI.LVTVIF_FIXEDSIZE; apiTileView.sizeTile = apiSize; _apiRetVal = ListViewAPI.SendMessage(this.Handle, ListViewAPI.LVM_SETTILEVIEWINFO, 0, ref apiTileView); this.ResumeLayout(); }