JD2022-TU1/main/tools/framework/JD.Timeline/Karaoke/LyricsPad.cs

55 lines
1.3 KiB
C#

using System;
using System.Windows.Forms;
using System.Windows.Forms.Integration;
using JD.Timeline.Document;
using TeaBox.ObjectModel;
namespace JD.Timeline.View.Pads
{
public class LyricsPad : AbstractPadContent
{
#region Variables
private readonly LyricsControl _lyricsControl = new LyricsControl();
private readonly ElementHost _host = new ElementHost();
#endregion
#region Constructor
public LyricsPad()
{
_host.Child = _lyricsControl;
TeaBox.ObjectModel.Application.Main.Views.SelectedItemChanged += Views_SelectedItemChanged;
Views_SelectedItemChanged(null, null);
}
#endregion
#region Properties
public override Control Control
{
get { return _host; }
}
public LyricsControl LyricsControl
{
get { return _lyricsControl; }
}
#endregion
#region Methods
private void Views_SelectedItemChanged(object sender, EventArgs e)
{
var view = TeaBox.ObjectModel.Application.Main.Views.SelectedItem as TapeDocumentView;
_lyricsControl.ClipViewControl = view != null ? view.ClipView : null;
}
#endregion
}
}