using System;
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.DrawingD;
using System.ComponentModel;
namespace wzsbmain


{

/**//// <summary>
/// Summary description for LabelGradient.
/// </summary>
public class wzsbmainLabel : System.Windows.Forms.Label

{

Implementtation Member Fields#region Implementtation Member Fields
protected Color gradientColorOne = Color.White;
protected Color gradientColorTwo = Color.Blue;
protected LinearGradientMode lgm = LinearGradientMode.ForwardDiagonal;
protected BorderDStyle bdstyle = BorderDStyle.Bump;
#endregion


GradientColorOne Properties#region GradientColorOne Properties
[
DefaultValue(typeof(Color),"White"),
Description("The first gradient color."),
Category("Appearance"),
]

//GradientColorOne Properties
public Color GradientColorOne

{
get

{
return gradientColorOne;
}
set

{
gradientColorOne = value;
Invalidate();
}
}
#endregion

GradientColorTwo Properties#region GradientColorTwo Properties
[
DefaultValue(typeof(Color),"Blue"),
Description("The second gradient color."),
Category("Appearance"),
]

//GradientColorTwo Properties
public Color GradientColorTwo

{
get

{
return gradientColorTwo;
}
set

{
gradientColorTwo = value;
Invalidate();
}
}

#endregion


LinearGradientMode Properties#region LinearGradientMode Properties
//LinearGradientMode Properties
[
DefaultValue(typeof(LinearGradientMode),"ForwardDiagonal"),
Description("Gradient Mode"),
Category("Appearance"),
]
public LinearGradientMode GradientMode

{
get

{
return lgm;
}
set

{
lgm = value;
Invalidate();
}
}
#endregion

BorderDStyle Properties#region BorderDStyle Properties
//BorderDStyle Properties
[
DefaultValue(typeof(BorderDStyle),"Bump"),
Description("BorderStyle"),
Category("Appearance"),
]

// hide BorderStyle inherited from the base class
new public BorderDStyle BorderStyle

{
get

{
return bdstyle;
}
set

{
bdstyle = value;
Invalidate();
}
}
#endregion


Removed Properties#region Removed Properties
// Remove BackColor Property
[
Browsable(false),
EditorBrowsable(EditorBrowsableState.Never)
]
public override System.Drawing.Color BackColor

{
get

{
return new System.Drawing.Color();
}

set
{;}
}
#endregion


// protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
// {
// Graphics gfx = e.Graphics;
// //BorderDStyle bdstyle = BorderDStyle.Bump;
// //BorderDSide bdside = BorderDSide.All;
//
// Rectangle rect = new Rectangle (0,0,this.Width,this.Height);
//
// // Dispose of brush resources after use
// using (LinearGradientBrush lgb = new LinearGradientBrush(rect, gradientColorOne,gradientColorTwo,lgm))
// gfx.FillRectangle(lgb,rect);
//
// //d border
// //ControlPaint.DrawBorderD(gfx,rect,bdstyle,bdside);
//
//
// // Call the OnPaint method of the base class
// base.OnPaint(e);
//
// }

protected override void OnPaintBackground(System.Windows.Forms.PaintEventArgs pevent)

{
Graphics gfx = pevent.Graphics;
Rectangle rect = new Rectangle (0,0,this.Width,this.Height);
// Dispose of brush resources after use
using (LinearGradientBrush lgb = new LinearGradientBrush(rect, gradientColorOne,gradientColorTwo,lgm))
gfx.FillRectangle(lgb,rect);
ControlPaint.DrawBorderD(gfx,rect,bdstyle);
}


}
}



posted on
2007-02-12 13:51
mbskys
阅读(
397)
评论()
收藏
举报