ControlC ControlC.com

[C#] BlueTabControl

Views: 33Total Chars: 2,427
Created: 6/5/12 12:18:09AM ET
Self Destructs: Never
using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
class BlueTabControl : TabControlDesigner
{

private Color C1;
private Color C2;
private Color C3;
private Color C4;
private Color C5;
private Color C6;
private LinearGradientBrush L1;

private LinearGradientBrush L2;
public BlueTabControl()
{
C1 = Information.RGB(207, 219, 236);
//Panel Color
C2 = Information.RGB(109, 106, 98);
//Line Color
C3 = ARGB(120, Color.White);
//Highlight
C4 = Information.RGB(171, 180, 194);
//Unselected Tab #1
C5 = Information.RGB(197, 208, 223);
//Unselected Tab #2
C6 = Information.RGB(110, 116, 124);
//Tab Line

Alignment = TabAlignment.Top;
Font = new Font("Verdana", 8);
ItemSize = new Size(130, 30);
PanelColor = Color.Transparent;

for (int I = 0; I <= TabPages.Count - 1; I++) {
TabPages(I).BackColor = C1;
}

}

protected override void TabPaint(int e)
{
dynamic Text = TabPages(e).Text;
dynamic Tab = GetTabRect(e);
dynamic Temp = new Rectangle(Tab.X + 1, Tab.Y + 1, Tab.Width - 6, Tab.Height + SelectedIndex == e ? 1 : 0);
dynamic Highlight = new Rectangle(Temp.X, Temp.Y, Temp.Width, 10);
dynamic Outline = new Point[] {
new Point(Temp.X, Temp.Bottom),
new Point(Temp.X, Temp.Top),
new Point(Temp.Right, Temp.Top),
new Point(Temp.Right, Temp.Bottom)
};

L1 = new LinearGradientBrush(Highlight, C3, Color.Transparent, 90);
L2 = new LinearGradientBrush(Temp, C4, C5, 90);

if (SelectedIndex == e) {
try {
TabPages(e).BackColor = C1;
} catch {
}
G.FillRectangle(ToBrush(C1), Temp);
G.FillRectangle(L1, Highlight);
} else if (State == MouseState.Over && Temp.Contains(Coordinates)) {
G.FillRectangle(L2, Temp);
G.FillRectangle(L1, Highlight);
} else {
G.FillRectangle(L2, Temp);
}

G.DrawLines(ToPen(C2), Outline);
G.DrawString(Text, Font, Brushes.Black, Center(Text, Font, Temp, 0, 0));

}

protected override void PaintHook()
{
dynamic Outline = new Point[] {
new Point(ClientRectangle.X + 3, ClientRectangle.Y + 34),
new Point(ClientRectangle.X + 3, ClientRectangle.Bottom - 4),
new Point(ClientRectangle.Right - 4, ClientRectangle.Bottom - 4),
new Point(ClientRectangle.Right - 4, ClientRectangle.Top + 34)
};
G.DrawLines(ToPen(C6), Outline);
G.DrawLine(ToPen(C6), 4, 33, Width - 4, 33);
}
}
2,427 chars, 295 words, 91 lines·Create new version