02. oktober 2004 - 01:59
#2
Hvis du ikke lige kan få det til at "se ud som på billedet", kan du bruge den her :
private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
Graphics canvas = e.Graphics;
Rectangle rect = new Rectangle( 10, 10, 100, 26 );
LinearGradientBrush gradientBrush = new LinearGradientBrush(
rect,
Color.White,
Color.White,
90, // gradient goes from top to bottom
false );
// This is used to give more control over how the gradient “blends”
ColorBlend blend = new ColorBlend();
// The colours the blend will consist of.
blend.Colors = new Color[] {
Color.FromArgb( 206, 231, 255 ),
Color.FromArgb( 206, 231, 255 ),
Color.FromArgb( 253, 253, 253 ),
Color.FromArgb( 205, 204, 223 ),
Color.FromArgb( 105, 130, 238 ),
Color.FromArgb( 105, 130, 238 ) };
// Where one colour starts and the other stops
blend.Positions =new float[] {0F,
0.05F,
0.2F,
0.8F,
0.95F,
1F};
// Assign the blend
gradientBrush.InterpolationColors = blend;
canvas.FillRectangle( gradientBrush, rect);
// Draw the border
rect.Width -= 1;
rect.Height -=1;
canvas.DrawRectangle( new Pen( Color.FromArgb( 0, 60, 116 )), rect);
}