mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-29 23:22:32 +00:00
42 lines
1.1 KiB
C#
42 lines
1.1 KiB
C#
|
using System.Drawing;
|
|||
|
using System.Windows.Forms;
|
|||
|
|
|||
|
// [ZZ] this is a copypasted version of TransparentPanel :)
|
|||
|
// implements the same functionality, except for a TrackBar, for use in tab controls.
|
|||
|
|
|||
|
namespace CodeImp.DoomBuilder.Controls
|
|||
|
{
|
|||
|
public class TransparentTrackBar : TrackBar
|
|||
|
{
|
|||
|
#region ================== Constructor / Disposer
|
|||
|
|
|||
|
// Constructor
|
|||
|
public TransparentTrackBar()
|
|||
|
{
|
|||
|
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region ================== Methods
|
|||
|
|
|||
|
protected override void OnCreateControl()
|
|||
|
{
|
|||
|
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
|||
|
if (Parent != null)
|
|||
|
BackColor = Parent.BackColor;
|
|||
|
|
|||
|
base.OnCreateControl();
|
|||
|
}
|
|||
|
|
|||
|
// Disable background drawing by overriding this
|
|||
|
protected override void OnPaintBackground(PaintEventArgs e)
|
|||
|
{
|
|||
|
if (BackColor != Color.Transparent)
|
|||
|
e.Graphics.Clear(BackColor);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|