81 lines
No EOL
1.8 KiB
C#
81 lines
No EOL
1.8 KiB
C#
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Windows.Forms;
|
|
using JD.Sequencers.Times;
|
|
using JD.Sequencers.Windowlesses;
|
|
using TeaBox.Core.Source.Gui;
|
|
|
|
namespace JD.Timeline.View.ClipView.Widgets
|
|
{
|
|
public class KaraokeClipSplitter : WindowlessControl
|
|
{
|
|
#region Variables
|
|
|
|
private static readonly Bitmap _pinBitmap = Properties.Resources.Icon_16x16_pin;
|
|
|
|
#endregion
|
|
|
|
#region Constructor
|
|
|
|
public KaraokeClipSplitter()
|
|
{
|
|
ParentChanged += KaraokeClipSplitter_ParentChanged;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Properties
|
|
|
|
public new KaraokeClipSection Parent
|
|
{
|
|
get
|
|
{
|
|
return (KaraokeClipSection)base.Parent;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Methods
|
|
|
|
public void SetupBounds()
|
|
{
|
|
if (Parent != null)
|
|
{
|
|
Bounds = new Rectangle(Parent.Bounds.Right - _pinBitmap.Width / 2, Parent.Bounds.Top - _pinBitmap.Height + 1, _pinBitmap.Width, _pinBitmap.Height);
|
|
}
|
|
}
|
|
|
|
protected override void OnPaint(PaintEventArgs e)
|
|
{
|
|
if (!IsVisible)
|
|
return;
|
|
|
|
SetupBounds();
|
|
|
|
var graphics = e.Graphics;
|
|
graphics.DrawImage(_pinBitmap, Bounds);
|
|
}
|
|
|
|
protected override void Dispose(bool disposing)
|
|
{
|
|
if (disposing)
|
|
{
|
|
ParentChanged -= KaraokeClipSplitter_ParentChanged;
|
|
}
|
|
|
|
base.Dispose(disposing);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Events
|
|
|
|
void KaraokeClipSplitter_ParentChanged(object sender, ValueChangedEventArgs<WindowlessControl> e)
|
|
{
|
|
SetupBounds();
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
} |