diff options
| author | lempamo <[email protected]> | 2017-10-21 00:51:46 -0400 |
|---|---|---|
| committer | lempamo <[email protected]> | 2017-10-21 00:51:46 -0400 |
| commit | 54a3e8fe71f936580339e4a4a6fb650d57fbb5d1 (patch) | |
| tree | 3d961d1d410a852561b31b13f951e4b4a4666c87 /Histacom2.Engine/UI/ClassicLabel.cs | |
| parent | 70c63256ccab2b3cfc6a0dc1b0591b26932a2d10 (diff) | |
| download | histacom2-54a3e8fe71f936580339e4a4a6fb650d57fbb5d1.tar.gz histacom2-54a3e8fe71f936580339e4a4a6fb650d57fbb5d1.tar.bz2 histacom2-54a3e8fe71f936580339e4a4a6fb650d57fbb5d1.zip | |
more xp start things
Diffstat (limited to 'Histacom2.Engine/UI/ClassicLabel.cs')
| -rw-r--r-- | Histacom2.Engine/UI/ClassicLabel.cs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/Histacom2.Engine/UI/ClassicLabel.cs b/Histacom2.Engine/UI/ClassicLabel.cs index c7007bd..4ef1201 100644 --- a/Histacom2.Engine/UI/ClassicLabel.cs +++ b/Histacom2.Engine/UI/ClassicLabel.cs @@ -12,8 +12,11 @@ namespace Histacom2.Engine.UI { public class ClassicLabel : Control { + public bool DropShadow { get; set; } + public ClassicLabel() { + SetStyle(ControlStyles.SupportsTransparentBackColor, true); TextChanged += (s, e) => Invalidate(); } @@ -21,11 +24,24 @@ namespace Histacom2.Engine.UI { 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 + { + // add the drop shadow flag for automatically drawing + // a drop shadow around the form + CreateParams cp = base.CreateParams; + if (DropShadow) cp.ClassStyle |= CS_DROPSHADOW; + return cp; + } + } } } |
