ControlC ControlC.com

[C#] GrayTabControl

Views: 104Total Chars: 1,724
Created: 6/5/12 12:15:26AM ET
Self Destructs: Never
using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
class GrayTabControl : TabControlDesigner
{

private Color C1;
private Color C2;
private Color C3;
private Color C4;
private Color C5;

private Color C6;

public GrayTabControl()
{
C1 = Color.FromArgb(103, 103, 103);
//Panel Color
C2 = Color.FromArgb(81, 81, 81);
C3 = Color.FromArgb(50, 50, 50);
C4 = Color.FromArgb(120, 120, 120);
C5 = Color.FromArgb(150, 150, 150);
C6 = Color.FromArgb(50, Color.Black);

Alignment = TabAlignment.Left;
ItemSize = new Size(44, 136);
SizeMode = TabSizeMode.Fixed;
ItemSize = new Size(40, 110);
Font = new Font("Verdana", 8);
PanelColor = C1;

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

}


protected override void TabPaint(int e)
{
dynamic T = TabPages(e).Text;
dynamic R = GetTabRect(e);
dynamic Temp = new Rectangle(R.X + 2, R.Y + 5, 110, 35);

if (SelectedIndex == e) {
try {
TabPages(e).BackColor = Color.WhiteSmoke;
} catch {
}

G.FillRectangle(ToBrush(C2), Temp);
G.DrawRectangle(ToPen(C3), Temp);

int X = 0;
int Y = 0;

X = Temp.Right;
Y = Temp.Y + Temp.Height / 2;

Point[] P = {
new Point(X, Y - 5),
new Point(X, Y + 5),
new Point(X - 5, Y)
};

G.FillPolygon(Brushes.WhiteSmoke, P);


} else if (State == MouseState.Over && Temp.Contains(Coordinates)) {
G.FillRectangle(ToBrush(C4), Temp);
G.DrawRectangle(ToPen(C5), Temp);

}

G.DrawString(T, Font, Brushes.Black, Center(T, Font, Temp, 0, -1));
G.DrawString(T, Font, Brushes.White, Center(T, Font, Temp));

}

}
1,724 chars, 224 words, 83 lines·Create new version