protected override void OnColumnClick(System.Windows.Forms.ColumnClickEventArgs e) { base.OnColumnClick(e); this.SuspendLayout(); if (_showInGroups) { int param = 0; ListViewAPI.SendMessage(this.Handle, ListViewAPI.LVM_ENABLEGROUPVIEW, 0, ref param); } this.ListViewItemSorter = new XPListViewItemComparer(e.Column); if (this.Sorting == SortOrder.Descending) { this.Sorting = SortOrder.Ascending; } else { this.Sorting = SortOrder.Descending; } this.Sort(); if (_showInGroups) { int param = 0; ListViewAPI.SendMessage(this.Handle, ListViewAPI.LVM_ENABLEGROUPVIEW, 1, ref param); if (_autoGroup == true) { AutoGroupByColumn(_autoGroupCol.Index); } else { Regroup(); } } this.ResumeLayout(); }
public bool Regroup() { try { ListViewAPI.ClearListViewGroup(this); foreach (XPListViewGroup grp in this.Groups) { ListViewAPI.AddListViewGroup(this, grp.GroupText, grp.GroupIndex); } foreach (XPListViewItem itm in this.Items) { ListViewAPI.AddItemToGroup(this, itm.Index, itm.GroupIndex); } int param = 0; ListViewAPI.SendMessage(this.Handle, ListViewAPI.LVM_ENABLEGROUPVIEW, 1, ref param); _showInGroups = true; _autoGroup = false; _autoGroupCol = null; _autoGroupList.Clear(); return(true); } catch (Exception ex) { throw new SystemException("Error in XPListView.Regroup: " + ex.Message); } }
public void SetTileHeight(int height) { ListViewAPI.LVTILEVIEWINFO apiTileView; this.SuspendLayout(); int param = 0; _apiRetVal = ListViewAPI.SendMessage(this.Handle, ListViewAPI.LVM_GETVIEW, ListViewAPI.LV_VIEW_TILE, ref param); if ((int)_apiRetVal != ListViewAPI.LV_VIEW_TILE) { return; } 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_FIXEDHEIGHT; apiTileView.sizeTile.cy = height; _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(); }
public void Remove(XPListViewGroup value) { ListViewAPI.RemoveListViewGroup(_owner, value.GroupIndex); if (GroupRemoved != null) { GroupRemoved(this, new ListViewGroupEventArgs(value)); } List.Remove(value); }
public int Add(XPListViewGroup value) { ListViewAPI.AddListViewGroup(_owner, value.GroupText, value.GroupIndex); if (GroupAdded != null) { GroupAdded(this, new ListViewGroupEventArgs(value)); } return(List.Add(value)); }
public int Add(string text, int index) { XPListViewGroup itm = new XPListViewGroup(text, index); ListViewAPI.AddListViewGroup(_owner, text, index); if (GroupAdded != null) { GroupAdded(this, new ListViewGroupEventArgs(itm)); } return(List.Add(itm)); }
public void AddRange(XPListViewItem[] values) { base.AddRange(values); foreach (XPListViewItem itm in values) { ListViewAPI.AddItemToGroup(((XPListView)itm.ListView), itm.Index, itm.GroupIndex); if (ItemAdded != null) { ItemAdded(this, new ListViewItemEventArgs(itm)); } } }
public XPListViewItem Add(XPListViewItem item) { XPListViewItem itm; itm = ((XPListViewItem)base.Add(item)); ListViewAPI.AddItemToGroup(((XPListView)itm.ListView), itm.Index, itm.GroupIndex); if (ItemAdded != null) { ItemAdded(this, new ListViewItemEventArgs(itm)); } return(itm); }
public bool AutoGroupByColumn(int columnID) { if (columnID >= this.Columns.Count || columnID < 0) { return(false); } try { _autoGroupList.Clear(); foreach (XPListViewItem itm in this.Items) { if ( !_autoGroupList.Contains(itm.SubItems[columnID].Text == "" ? _emptyAutoGroupText : itm.SubItems[columnID].Text)) { _autoGroupList.Add(itm.SubItems[columnID].Text == "" ? EmptyAutoGroupText : itm.SubItems[columnID].Text); } } _autoGroupList.Sort(); ListViewAPI.ClearListViewGroup(this); foreach (string text in _autoGroupList) { ListViewAPI.AddListViewGroup(this, text, _autoGroupList.IndexOf(text)); } foreach (XPListViewItem itm in this.Items) { ListViewAPI.AddItemToGroup(this, itm.Index, _autoGroupList.IndexOf(itm.SubItems[columnID].Text == "" ? _emptyAutoGroupText : itm.SubItems[columnID].Text)); } int param = 0; ListViewAPI.SendMessage(this.Handle, ListViewAPI.LVM_ENABLEGROUPVIEW, 1, ref param); _showInGroups = true; _autoGroup = true; _autoGroupCol = this.Columns[columnID]; this.Refresh(); return(true); } catch (Exception ex) { throw new SystemException("Error in XPListView.AutoGroupByColumn: " + ex.Message); } }
private void _items_ItemAdded(object sender, ListViewItemEventArgs e) { string text; if (_autoGroup) { text = e.Item.SubItems[_autoGroupCol.Index].Text; if (!_autoGroupList.Contains(text)) { _autoGroupList.Add(text); ListViewAPI.AddListViewGroup(this, text, _autoGroupList.IndexOf(text)); } ListViewAPI.AddItemToGroup(this, e.Item.Index, _autoGroupList.IndexOf(text)); } }
public void ShowTiles(int[] columns) { ListViewAPI.LVTILEVIEWINFO apiTileView; ListViewAPI.LVTILEINFO apiTile; IntPtr lpcol = Marshal.AllocHGlobal(columns.Length * 4); Marshal.Copy(columns, 0, lpcol, columns.Length); int param = 0; _apiRetVal = ListViewAPI.SendMessage(this.Handle, ListViewAPI.LVM_SETVIEW, ListViewAPI.LV_VIEW_TILE, ref param); apiTileView = new ListViewAPI.LVTILEVIEWINFO(); apiTileView.cbSize = Marshal.SizeOf(typeof(ListViewAPI.LVTILEVIEWINFO)); apiTileView.dwMask = ListViewAPI.LVTVIM_COLUMNS | ListViewAPI.LVTVIM_TILESIZE; apiTileView.dwFlags = ListViewAPI.LVTVIF_AUTOSIZE; apiTileView.cLines = columns.Length; _apiRetVal = ListViewAPI.SendMessage(this.Handle, ListViewAPI.LVM_SETTILEVIEWINFO, 0, ref apiTileView); foreach (XPListViewItem itm in this.Items) { apiTile = new ListViewAPI.LVTILEINFO(); apiTile.cbSize = Marshal.SizeOf(typeof(ListViewAPI.LVTILEINFO)); apiTile.iItem = itm.Index; apiTile.cColumns = columns.Length; apiTile.puColumns = (int)lpcol; _apiRetVal = ListViewAPI.SendMessage(this.Handle, ListViewAPI.LVM_SETTILEINFO, 0, ref apiTile); } //columns = null; Marshal.FreeHGlobal(lpcol); }
public new void Clear() { ListViewAPI.ClearListViewGroup(_owner); List.Clear(); }
public void SetBackgroundImage(string ImagePath, ImagePosition Position) { ListViewAPI.SetListViewImage(this, ImagePath, Position); }
public void UpdateItems() { ListViewAPI.UpdateItems(this); }
public void RedrawItems() { ListViewAPI.RedrawItems(this, true); this.ArrangeIcons(); }