Download KarubButtonDemo.zip - 45.5 KB
Download KarubButtonSourceAndLibrary.zip - 235.3 KB

Introduction
This is my Karub Button.It has a few style feature.You can create your button style and you must test it.The button has several color property.These;normal state color,highlighted state color and pressed state color.For instance;
-Normal State Style:

-Highlighted State Style:

-And Pressed State Style:

Background
This project language is C#.2005.It included of several property.For example;button icon,icon style,text style,text dimension,layer style,icon and text alignment and much more.But;you can see some property on an article.Look at my property window.

-Icon Style:
Highlighted type:

Whitened type:

DarkColor type:
and much more style for this property.
-One sample text style:

you can change text style on this button.Only,you must do select your favourite text style at this project.
-Another Karub Button Style:

if you want to change your icon or text location on the button,you must do select of connected with property.You can exchange a lot of special feature at this button control.
Using the code
protected virtual void DrawButton(Graphics g)
{
Rectangle backRect = new Rectangle();
Rectangle ShineRect = new Rectangle();
if (_sinir == BorderLine.Up)
{
backRect = new Rectangle(1, this.Height / 2 - 1, this.Width - 2, this.Height / 2);
ShineRect = new Rectangle(1, 1, this.Width - 2, this.Height / 2 - 2);
}
else if (_sinir == BorderLine.Center)
{
backRect = new Rectangle(1, this.Height / 2, this.Width - 2, this.Height / 2 - 1);
ShineRect = new Rectangle(1, 1, this.Width - 2, this.Height / 2 - 1);
}
else if (_sinir == BorderLine.Down)
{
backRect = new Rectangle(1, this.Height / 2 + 1, this.Width - 2, this.Height / 2 - 2);
ShineRect = new Rectangle(1, 1, this.Width - 2, this.Height / 2);
}
LinearGradientBrush lgb;
int k = (int)butonDurum;
if (_buttonStyle == Style.CalmCyan)
{
lgb = new LinearGradientBrush(backRect, renkDizi[0][k, 1], renkDizi[0][k, 0], LinearGradientMode.Vertical);
g.FillRectangle(lgb, backRect);
lgb = new LinearGradientBrush(ShineRect, renkDizi[0][k, 2], renkDizi[0][k, 3], LinearGradientMode.Vertical);
g.FillRectangle(lgb, ShineRect);
g.DrawLine(new Pen(renkDizi[0][k, 6]), 1, 1, this.Width - 2, 1);
g.DrawLine(new Pen(renkDizi[0][k, 7]), 1, this.Height - 2, this.Width - 2, this.Height - 2);
g.DrawLine(new Pen(renkDizi[0][k, 4]), 1, 1, 1, this.Height - 2);
g.DrawLine(new Pen(renkDizi[0][k, 5]), this.Width - 2, 1, this.Width - 2, this.Height - 3);
if (uzeri)
g.DrawRectangle(new Pen(renkCenter[0]), 0, 0, this.Width - 1, this.Height - 1);
}
else if (_buttonStyle == Style.DiamondRed)
{
lgb = new LinearGradientBrush(backRect, renkDizi[1][k, 1], renkDizi[1][k, 0], LinearGradientMode.Vertical);
g.FillRectangle(lgb, backRect);
lgb = new LinearGradientBrush(ShineRect, renkDizi[1][k, 2], renkDizi[1][k, 3], LinearGradientMode.Vertical);
g.FillRectangle(lgb, ShineRect);
g.DrawLine(new Pen(renkDizi[1][k, 6]), 1, 1, this.Width - 2, 1);
g.DrawLine(new Pen(renkDizi[1][k, 7]), 1, this.Height - 2, this.Width - 2, this.Height - 2);
g.DrawLine(new Pen(renkDizi[1][k, 4]), 1, 1, 1, this.Height - 2);
g.DrawLine(new Pen(renkDizi[1][k, 5]), this.Width - 2, 1, this.Width - 2, this.Height - 3);
if (uzeri)
g.DrawRectangle(new Pen(renkCenter[1]), 0, 0, this.Width - 1, this.Height - 1);
}
else
{
lgb = new LinearGradientBrush(backRect, renkDizi[2][k, 1], renkDizi[2][k, 0], LinearGradientMode.Vertical);
g.FillRectangle(lgb, backRect);
lgb = new LinearGradientBrush(ShineRect, renkDizi[2][k, 2], renkDizi[2][k, 3], LinearGradientMode.Vertical);
g.FillRectangle(lgb, ShineRect);
g.DrawLine(new Pen(renkDizi[2][k, 6]), 1, 1, this.Width - 2, 1);
g.DrawLine(new Pen(renkDizi[2][k, 7]), 1, this.Height - 2, this.Width - 2, this.Height - 2);
g.DrawLine(new Pen(renkDizi[2][k, 4]), 1, 1, 1, this.Height - 2);
g.DrawLine(new Pen(renkDizi[2][k, 5]), this.Width - 2, 1, this.Width - 2, this.Height - 3);
if (uzeri)
g.DrawRectangle(new Pen(renkCenter[2]), 0, 0, this.Width - 1, this.Height - 1);
}
if (_Layer != LayerStatus.None)
{
int x = 0, y = 0;
switch (_Layer)
{
case LayerStatus.Bottom:
y += Size.Height / 2 - 1;
break;
case LayerStatus.BottomLeft:
x -= Size.Width / 2;
y += Size.Height / 2 - 1;
break;
case LayerStatus.BottomRight:
x += Size.Width / 2;
y += Size.Height / 2 - 1;
break;
case LayerStatus.Left:
x -= Size.Width / 2;
break;
case LayerStatus.Right:
x += Size.Width / 2;
break;
case LayerStatus.Top:
y -= Size.Height / 2 + 1;
break;
case LayerStatus.TopLeft:
x -= Size.Width / 2;
y -= Size.Height / 2 + 1;
break;
case LayerStatus.TopRight:
x += Size.Width / 2;
y -= Size.Height / 2 + 1;
break;
}
Point startPoint = new Point(x - _GlowLength, y - _GlowLength);
GraphicsPath pth = new GraphicsPath();
pth.AddRectangle(new Rectangle(startPoint, new Size(Size.Width + _GlowLength * 2, Size.Height + _GlowLength * 2)));
PathGradientBrush pgb = new PathGradientBrush(pth);
pgb.CenterColor = _layerCenterColor;
pgb.SurroundColors = new Color[] { Color.Transparent };
pgb.FocusScales = new PointF(0.7F, 0.7F);
ColorBlend cb = new ColorBlend(2);
cb.Positions[0] = 0.0F;
cb.Positions[1] = 1.0F;
cb.Colors = new Color[] { Color.Transparent, Color.FromArgb(150, 93, 198, 242) };
pgb.InterpolationColors = cb;
pgb.FocusScales = new PointF(0.7F, 0.7F);
g.FillPath(pgb, pth);
lgb.Dispose();
pgb.Dispose();
pth.Dispose();
}
}
Points of Interest
-Database application (SQL SERVER 2000 - 2005) and a little bit Oracle Database.
-Win32 application,use with c and c# programming language.
-Windows custom controls.
-Developing base of Intranet and Internet applications.
History - Burak Özdiken
I am .Net programmer.I have been developing software application and project since 1998.My first programming language is Visual Basic 4.0 - 5.0.At now,My programming language is c# and vb.net.Also,I am developing enterprise application for company.
You can send your message from your e-mail.
My e-mail adresses:
burakozdiken@mynet.com and burakozdiken@ttnet.net.tr