Exemplo n.º 1
0
        internal void DrawTab(Graphics g, TabPage tabPage, int nIndex)
        {
            Rectangle  recBounds   = GetTabRect(nIndex);
            RectangleF tabTextArea = GetTabRect(nIndex);

            bool hasErrors = CheckForErrors(tabPage.Controls);

            bool isSelected = (SelectedIndex == nIndex);

            var pt = GetPolyPoints(recBounds);

            //-------------------------------------------//
            //--- fill this tab with background color ---//
            //-------------------------------------------//
            Color tabBackColor = (hasErrors ? GetErrorColor(isSelected) :
                                  isSelected ? tabPage.BackColor : UTRSGraphicsUtils.DarkenColor(tabPage.BackColor, 10)
                                  );

            DrawTabBackground(g, tabBackColor, pt);
            DrawTabBorder(g, tabPage, pt, isSelected, ref recBounds);
            DrawTabIcon(g, tabPage, nIndex, ref recBounds, ref tabTextArea, hasErrors);
            DrawTabText(g, tabPage, ref tabTextArea, hasErrors);
        }
Exemplo n.º 2
0
        private static void DrawTabBackground(Graphics g, Color tabBackColor, Point[] pt)
        {
            Rectangle    rc   = new Rectangle(pt[0], new Size(pt[5]));
            GraphicsPath path = new GraphicsPath();

            path.AddLines(pt);
            using (LinearGradientBrush pthGrBrush = new LinearGradientBrush(rc, tabBackColor, UTRSGraphicsUtils.DarkenColor(tabBackColor, 5), LinearGradientMode.Vertical))
            {
                g.FillPath(pthGrBrush, path);
                pthGrBrush.Dispose();
            }
        }
Exemplo n.º 3
0
 private Color GetErrorColor(bool isSelected)
 {
     return(isSelected ? _errColor : UTRSGraphicsUtils.DarkenColor(_errColor, 10));
 }