diff options
Diffstat (limited to 'Histacom2.Engine/UI/ClassicLabel.cs')
| -rw-r--r-- | Histacom2.Engine/UI/ClassicLabel.cs | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/Histacom2.Engine/UI/ClassicLabel.cs b/Histacom2.Engine/UI/ClassicLabel.cs index f207eb1..eba8dc6 100644 --- a/Histacom2.Engine/UI/ClassicLabel.cs +++ b/Histacom2.Engine/UI/ClassicLabel.cs @@ -12,20 +12,34 @@ namespace Histacom2.Engine.UI { public class ClassicLabel : Control { + public bool DropShadow { get; set; } + public ClassicLabel() { - + SetStyle(ControlStyles.SupportsTransparentBackColor, true); + TextChanged += (s, e) => Invalidate(); } protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); var gfx = e.Graphics; - gfx.Clear(BackColor); + if (BackColor != Color.Transparent) gfx.Clear(BackColor); gfx.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit; gfx.DrawString(Text, Font, new SolidBrush(ForeColor), ClientRectangle); Height = (int)gfx.MeasureString(Text, Font, ClientRectangle.Width).Height; } + + private const int CS_DROPSHADOW = 0x00020000; + protected override CreateParams CreateParams + { + get + { + CreateParams cp = base.CreateParams; + if (DropShadow) cp.ClassStyle |= CS_DROPSHADOW; + return cp; + } + } } } |
