Esempio n. 1
0
 /// <summary>
 /// paint header background
 /// </summary>
 /// <param name="pcust"></param>
 /// <param name="rect"></param>
 internal virtual void PaintBackGround(NativeCustomDraw.NMCUSTOMDRAW pcust, NativeWindowCommon.RECT rect)
 {
     if (TitleBrush != IntPtr.Zero)
     {
         NativeWindowCommon.FillRect(pcust.hdc, ref rect, TitleBrush);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Draw Header section filter
        /// </summary>
        /// <param name="hdc"></param>
        /// <param name="rct"></param>
        /// <param name="g"></param>
        public void DrawFilter(IntPtr hdc, NativeWindowCommon.RECT rct)
        {
            //Filter line drawing
            int x       = rct.right - FILTER_WIDTH;
            int bottomY = 0;

            Header.HeaderRenderer.DrawLine(hdc, new Point(x, bottomY), new Point(x, Header.FilterHeight));

            //Filter highlight drawing
            NativeWindowCommon.RECT rectHighlight = new NativeWindowCommon.RECT()
            {
                bottom = Header.FilterHeight,
                top    = 0,
                left   = rct.right - FILTER_WIDTH + 1,
                right  = rct.right + 1
            };

            if ((FilterColor != Color.Empty) && !Header.OnSectionResize)
            {
                if (Header.TitleColor != Color.Empty)
                {
                    Header.HighlightBrush = NativeWindowCommon.CreateSolidBrush(ColorTranslator.ToWin32(FilterColor));
                }
                else
                {
                    Header.HighlightBrush = NativeWindowCommon.CreateSolidBrush(ColorTranslator.ToWin32(Color.FromArgb(255, 149, 202, 255)));
                }
                NativeWindowCommon.FillRect(hdc, ref rectHighlight, Header.HighlightBrush);
                NativeWindowCommon.DeleteObject(Header.HighlightBrush);
            }

            int filterWidthIcon = FILTER_WIDTH / 3;

            //Filter arrow drawing
            NativeWindowCommon.POINT[] points = new NativeWindowCommon.POINT[3];
            //right
            points[0].x = rct.right - filterWidthIcon;
            points[0].y = rct.top + (rct.bottom - rct.top) / 2 - 2;

            // center point
            points[1].x = rct.right - FILTER_WIDTH / 2;
            points[1].y = points[0].y + filterWidthIcon / 2;

            // left point
            points[2].x = points[0].x - filterWidthIcon;
            points[2].y = points[0].y;

            NativeWindowCommon.SelectObject(hdc, Header.FilterBrush);
            NativeWindowCommon.SelectObject(hdc, Header.FilterPen);
            NativeWindowCommon.Polygon(hdc, points, 3);
        }