/// <summary>
        /// The set group state.
        /// </summary>
        /// <param name="lstvwgrp">
        /// The lstvwgrp.
        /// </param>
        /// <param name="state">
        /// The state.
        /// </param>
        private void SetGroupState(ListViewGroup lstvwgrp, ListViewGroupState state)
        {
            if (!SupportCollapsibleGroups)
            {
                return;
            }

            if (lstvwgrp == null)
            {
                return;
            }

            int? grpId = GetGroupID(lstvwgrp);
            int grpIdParam = grpId ?? lstvwgrp.ListView.Groups.IndexOf(lstvwgrp);

            LVGROUP group = new LVGROUP
                                {
                                    CbSize = Marshal.SizeOf(typeof(LVGROUP)),
                                    State = state,
                                    Mask = ListViewGroupMask.State,
                                    IGroupId = grpIdParam
                                };

            SendMessage(this.Handle, (int)W32_LVM.LVM_SETGROUPINFO, grpIdParam, ref group);
        }
 public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, ref LVGROUP lParam);
        /// <summary>
        /// The set group footer.
        /// </summary>
        /// <param name="lstvwgrp">
        /// The lstvwgrp.
        /// </param>
        /// <param name="footer">
        /// The footer.
        /// </param>
        public void SetGroupFooter(ListViewGroup lstvwgrp, string footer)
        {
            if (!SupportCollapsibleGroups)
            {
                return;
            }

            if (lstvwgrp == null)
            {
                return;
            }

            int? grpId = GetGroupID(lstvwgrp);
            int grpIdParam = grpId ?? this.Groups.IndexOf(lstvwgrp);

            LVGROUP group = new LVGROUP
                                {
                                    CbSize = Marshal.SizeOf(typeof(LVGROUP)),
                                    PszFooter = footer,
                                    Mask = ListViewGroupMask.Footer,
                                    IGroupId = grpIdParam
                                };

            SendMessage(lstvwgrp.ListView.Handle, (int)W32_LVM.LVM_SETGROUPINFO, grpIdParam, ref group);
        }