internal void DrawControl(Graphics g) { if (!Visible) { return; } Rectangle TabControlArea = this.ClientRectangle; Rectangle TabArea = this.DisplayRectangle; //DONT DELETE THIS, CODE NEEDED TO FILL COLOR TO TAB EMPTY AREA //---------------------------- // fill client area //Brush br = new SolidBrush(mBackColor); //Brush br = new SolidBrush(UITheme.MainWindowBackColor); Rectangle tabrect = TabControlArea; tabrect.Height = this.GetTabRect(0).Height + 5; Brush br = new LinearGradientBrush( tabrect, UITheme.MainWindowBackColor, UITheme.GetLighterColor(UITheme.MainWindowBackColor, 20), LinearGradientMode.Vertical); g.FillRectangle(br, TabControlArea); br.Dispose(); //---------------------------- //---------------------------- // draw border int nDelta = SystemInformation.Border3DSize.Width; Pen border = new Pen(mBorderColor); TabArea.Inflate(nDelta, nDelta); g.DrawRectangle(border, TabArea); border.Dispose(); //Pen pshadow = new Pen(UITheme.GetLighterColor(mBorderColor, 100)); //Rectangle rshadow = TabArea; //rshadow.Inflate(1, 1); //g.DrawRectangle(pshadow, rshadow); //pshadow.Dispose(); //---------------------------- //---------------------------- // clip region for drawing tabs Region rsaved = g.Clip; Rectangle rreg; int nWidth = TabArea.Width + nMargin; rreg = new Rectangle(TabArea.Left, TabControlArea.Top, nWidth - nMargin, TabControlArea.Height); g.SetClip(rreg); // draw tabs for (int i = 0; i < this.TabCount; i++) { DrawTab(g, this.TabPages[i], i); } g.Clip = rsaved; //---------------------------- //---------------------------- // draw background to cover flat border areas if (this.SelectedTab != null) { TabPage tabPage = this.SelectedTab; Color color = tabPage.BackColor; border = new Pen(color); TabArea.Offset(1, 1); TabArea.Width -= 2; TabArea.Height -= 2; g.DrawRectangle(border, TabArea); TabArea.Width -= 1; TabArea.Height -= 1; g.DrawRectangle(border, TabArea); border.Dispose(); } //---------------------------- }