BrightIdeasSoftware.HeaderControl.DrawUnthemedSortIndicator C# (CSharp) Метод

DrawUnthemedSortIndicator() защищенный Метод

Draw a sort indicator without using themes
protected DrawUnthemedSortIndicator ( Graphics g, Rectangle r ) : Rectangle
g System.Drawing.Graphics
r System.Drawing.Rectangle
Результат System.Drawing.Rectangle
        protected Rectangle DrawUnthemedSortIndicator(Graphics g, Rectangle r)
        {
            // No theme support for sort indicators. So, we draw a triangle at the right edge
            // of the column header.
            const int triangleHeight = 16;
            const int triangleWidth = 16;
            const int midX = triangleWidth / 2;
            const int midY = (triangleHeight / 2) - 1;
            const int deltaX = midX - 2;
            const int deltaY = deltaX / 2;

            Point triangleLocation = new Point(r.Right - triangleWidth - 2, r.Top + (r.Height - triangleHeight) / 2);
            Point[] pts = new Point[] { triangleLocation, triangleLocation, triangleLocation };

            if (this.ListView.LastSortOrder == SortOrder.Ascending) {
                pts[0].Offset(midX - deltaX, midY + deltaY);
                pts[1].Offset(midX, midY - deltaY - 1);
                pts[2].Offset(midX + deltaX, midY + deltaY);
            } else {
                pts[0].Offset(midX - deltaX, midY - deltaY);
                pts[1].Offset(midX, midY + deltaY);
                pts[2].Offset(midX + deltaX, midY - deltaY);
            }

            g.FillPolygon(Brushes.SlateGray, pts);
            r.Width = r.Width - triangleWidth;
            return r;
        }