public static int AddListViewGroup(XPListView lst, string text, int index) { LVGROUP apiGroup; int ptrRetVal; try { if (lst == null) { return(-1); } apiGroup = new LVGROUP(); apiGroup.mask = LVGF_GROUPID | LVGF_HEADER | LVGF_STATE; apiGroup.pszHeader = text; apiGroup.cchHeader = apiGroup.pszHeader.Length; apiGroup.iGroupId = index; apiGroup.stateMask = LVGS_NORMAL; apiGroup.state = LVGS_NORMAL; apiGroup.cbSize = Marshal.SizeOf(typeof(LVGROUP)); ptrRetVal = (int)SendMessage(lst.Handle, ListViewAPI.LVM_INSERTGROUP, -1, ref apiGroup); return(ptrRetVal); } catch (Exception ex) { throw new System.Exception("An exception in ListViewAPI.AddListViewGroup occured: " + ex.Message); } }
public static void SetListViewImage(XPListView lst, string ImagePath, ImagePosition Position) { int x = 0; int y = 0; GetImageLocation(Position, ref x, ref y); try { LVBKIMAGE apiItem = new LVBKIMAGE(); apiItem.pszImage = ImagePath + Convert.ToChar(0); apiItem.cchImageMax = ImagePath.Length; apiItem.ulFlags = LVBKIF_SOURCE_URL | LVBKIF_STYLE_NORMAL; apiItem.xOffsetPercent = x; apiItem.yOffsetPercent = y; // Set the background colour of the ListView to 0XFFFFFFFF (-1) so it will be transparent int clear = CLR_NONE; SendMessage(lst.Handle, LVM_SETTEXTBKCOLOR, 0, ref clear); SendMessage(lst.Handle, LVM_SETBKIMAGE, 0, ref apiItem); } catch (Exception ex) { throw new System.Exception("An exception in ListViewAPI.SetListViewImage occured: " + ex.Message); } }
public static void RedrawItems(XPListView lst, bool update) { int ptrRetVal; try { if (lst != null) { return; } int param = lst.Items.Count - 1; ptrRetVal = (int)SendMessage(lst.Handle, LVM_REDRAWITEMS, 0, ref param); if (update) { UpdateItems(lst); } lst.Refresh(); } catch (Exception ex) { throw new System.Exception("An exception in ListViewAPI.RedrawItems occured: " + ex.Message); } }
public static int AddItemToGroup(XPListView lst, int index, int groupID) { LVITEM apiItem; int ptrRetVal; try { if (lst == null) { return(0); } apiItem = new LVITEM(); apiItem.mask = LVIF_GROUPID; apiItem.iItem = index; apiItem.iGroupId = groupID; ptrRetVal = (int)SendMessage(lst.Handle, ListViewAPI.LVM_SETITEM, 0, ref apiItem); return(ptrRetVal); } catch (Exception ex) { throw new System.Exception("An exception in ListViewAPI.AddItemToGroup occured: " + ex.Message); } }
public static void ClearListViewGroup(XPListView lst) { int ptrRetVal; try { if (lst == null) { return; } int param = 0; ptrRetVal = (int)SendMessage(lst.Handle, LVM_REMOVEALLGROUPS, 0, ref param); } catch (Exception ex) { throw new System.Exception("An exception in ListViewAPI.ClearListViewGroup occured: " + ex.Message); } }
public static int RemoveListViewGroup(XPListView lst, int index) { int ptrRetVal; try { if (lst != null) { return(-1); } int param = 0; ptrRetVal = (int)SendMessage(lst.Handle, LVM_REMOVEGROUP, index, ref param); return(ptrRetVal); } catch (Exception ex) { throw new System.Exception("An exception in ListViewAPI.RemoveListViewGroup occured: " + ex.Message); } }
public static void UpdateItems(XPListView lst) { int ptrRetVal; try { if (lst != null) { return; } for (int i = 0; i < lst.Items.Count - 1; i++) { int param = 0; ptrRetVal = (int)SendMessage(lst.Handle, LVM_UPDATE, i, ref param); } } catch (Exception ex) { throw new System.Exception("An exception in ListViewAPI.UpdateItems occured: " + ex.Message); } }
public XPListViewItemCollection(XPListView owner) : base(((ListView)owner)) { }
public XPListViewGroupCollection(XPListView owner) { _owner = owner; }