Esempio n. 1
0
 private static void setGrpFooter(ListViewGroup lstvwgrp, string footer)
 {
     if (Environment.OSVersion.Version.Major < 6)   //Only Vista and forward allows footer on ListViewGroups
         return;
     if (lstvwgrp == null || lstvwgrp.ListView == null)
         return;
     if (lstvwgrp.ListView.InvokeRequired)
         lstvwgrp.ListView.Invoke(new CallbackSetGroupString(setGrpFooter), lstvwgrp, footer);
     else
     {
         int? GrpId = GetGroupID(lstvwgrp);
         int gIndex = lstvwgrp.ListView.Groups.IndexOf(lstvwgrp);
         LVGROUP group = new LVGROUP();
         group.CbSize = Marshal.SizeOf(group);
         group.PszFooter = footer;
         group.Mask = ListViewGroupMask.Footer;
         if (GrpId != null)
         {
             group.IGroupId = GrpId.Value;
             SendMessage(lstvwgrp.ListView.Handle, LVM_SETGROUPINFO, GrpId.Value, group);
         }
         else
         {
             group.IGroupId = gIndex;
             SendMessage(lstvwgrp.ListView.Handle, LVM_SETGROUPINFO, gIndex, group);
         }
     }
 }
Esempio n. 2
0
 private static void setGrpState(ListViewGroup lstvwgrp, ListViewGroupState state)
 {
     if (Environment.OSVersion.Version.Major < 6)   //Only Vista and forward allows collaps of ListViewGroups
         return;
     if (lstvwgrp == null || lstvwgrp.ListView == null)
         return;
     if (lstvwgrp.ListView.InvokeRequired)
         lstvwgrp.ListView.Invoke(new CallBackSetGroupState(setGrpState), lstvwgrp, state);
     else
     {
         int? GrpId = GetGroupID(lstvwgrp);
         int gIndex = lstvwgrp.ListView.Groups.IndexOf(lstvwgrp);
         LVGROUP group = new LVGROUP();
         group.CbSize = Marshal.SizeOf(group);
         group.State = state;
         group.Mask = ListViewGroupMask.State;
         if (GrpId != null)
         {
             group.IGroupId = GrpId.Value;
             SendMessage(lstvwgrp.ListView.Handle, LVM_SETGROUPINFO, GrpId.Value, group);
             SendMessage(lstvwgrp.ListView.Handle, LVM_SETGROUPINFO, GrpId.Value, group);
         }
         else
         {
             group.IGroupId = gIndex;
             SendMessage(lstvwgrp.ListView.Handle, LVM_SETGROUPINFO, gIndex, group);
             SendMessage(lstvwgrp.ListView.Handle, LVM_SETGROUPINFO, gIndex, group);
         }
         lstvwgrp.ListView.Refresh();
     }
 }
Esempio n. 3
0
 private static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, LVGROUP lParam);