diff options
| author | Alex-TIMEHACK <[email protected]> | 2017-10-24 11:27:51 +0100 |
|---|---|---|
| committer | Alex-TIMEHACK <[email protected]> | 2017-10-24 11:27:51 +0100 |
| commit | 3d2e297b43cbd7f99269c9a58b25651a83ccef3c (patch) | |
| tree | ef636bc39af2b880af61acde98a2c5fb9e92cbaa /Histacom2.Engine/UI/ClassicLabel.cs | |
| parent | e5f29e7b53322e11578acd0deb3b1d454998bb77 (diff) | |
| parent | aff052b475abc5d4035369a85fa471f62cad021b (diff) | |
| download | histacom2-3d2e297b43cbd7f99269c9a58b25651a83ccef3c.tar.gz histacom2-3d2e297b43cbd7f99269c9a58b25651a83ccef3c.tar.bz2 histacom2-3d2e297b43cbd7f99269c9a58b25651a83ccef3c.zip | |
Updated my fork!
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; + } + } } } |
