Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="Column"></param>
        /// <returns></returns>
        private int ColumnAtIndex(int Column)
        {
            ListViewNativeMethods.HDITEM hd = new ListViewNativeMethods.HDITEM();

            hd.mask = HDI_ORDER;

            for (int i = 0; i < ColumnCount; i++)
            {
                if (ListViewNativeMethods.SendMessage(HeaderWnd, HDM_GETITEMA, Column, ref hd) != IntPtr.Zero)
                {
                    return(hd.iOrder);
                }
            }
            return(0);
        }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        private Rectangle HeaderEndRect()
        {
            ListViewNativeMethods.RECT rect = new ListViewNativeMethods.RECT();

            IntPtr headerWnd = HeaderWnd;

            ListViewNativeMethods.SendMessage(headerWnd, HDM_GETITEMRECT, ColumnAtIndex(ColumnCount - 1), ref rect);

            int left = rect.Right;

            ListViewNativeMethods.GetWindowRect(headerWnd, ref rect);

            ListViewNativeMethods.OffsetRect(ref rect, -rect.Left, -rect.Top);

            rect.Left = left;

            return(Rectangle.FromLTRB(rect.Left, rect.Top, rect.Right, rect.Bottom));
        }