本文整理汇总了C#中System.Windows.Forms.DragEventArgs.GetDropObject方法的典型用法代码示例。如果您正苦于以下问题:C# DragEventArgs.GetDropObject方法的具体用法?C# DragEventArgs.GetDropObject怎么用?C# DragEventArgs.GetDropObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.DragEventArgs
的用法示例。
在下文中一共展示了DragEventArgs.GetDropObject方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: panelTrackName_DragDrop
void panelTrackName_DragDrop(object sender, DragEventArgs e)
{
var d = e.GetDropObject<PEMidiTrack>();
if (d != null && d != this)
{
ItemDropped.IfObjectNotNull(x => x(this, e));
}
}
示例2: panelTrackName_DragEnter
void panelTrackName_DragEnter(object sender, DragEventArgs e)
{
e.Effect = DragDropEffects.None;
var d = e.GetDropObject<PEMidiTrack>();
if (d != null && d != this)
{
e.Effect = DragDropEffects.All;
}
}
示例3: Button_DragEnter
void Button_DragEnter(object sender, DragEventArgs e)
{
e.Effect = DragDropEffects.None;
var dropDiff = e.GetDropObject<PETrackDifficulty>();
if (dropDiff != null)
{
var btn = DifficultyButtons.SingleOrDefault(x => x.Button == sender);
if ((dropDiff.MidiTrack != btn.MidiTrack) || (dropDiff.MidiTrack == btn.MidiTrack && dropDiff.Difficulty != btn.Difficulty))
{
e.Effect = DragDropEffects.All;
}
}
}
示例4: Button_DragDrop
void Button_DragDrop(object sender, DragEventArgs e)
{
var dropDiff = e.GetDropObject<PETrackDifficulty>();
if (dropDiff != null)
{
var btn = DifficultyButtons.SingleOrDefault(x => x.Button == sender);
if ((dropDiff.MidiTrack != btn.MidiTrack) || (dropDiff.MidiTrack == btn.MidiTrack && dropDiff.Difficulty != btn.Difficulty))
{
DifficultyItemDropped.IfObjectNotNull(d => d(this, DifficultyButtons.Single(x => x.Button == sender).Difficulty, e));
}
}
}
示例5: peTrack_ItemDropped
void peTrack_ItemDropped(PEMidiTrack sender, DragEventArgs e)
{
var peTrack = e.GetDropObject<PEMidiTrack>();
peTrack.IfObjectNotNull(x =>
{
if (peTrack != sender)
{
DoRequestBackup();
Track newTrack = null;
if (sender.Track.Sequence == peTrack.Track.Sequence)
{
newTrack = peTrack.Track;
sender.Track.Sequence.MoveTrack(peTrack.Track.GetTrackIndex(), GetInsertAt());
}
else
{
if (IsPro && peTrack.Track.Name.IsProTrackName())
{
newTrack = new Track(FileType.Pro, peTrack.Track.Name);
newTrack.Merge(peTrack.Track);
}
else if (IsPro == false && peTrack.Track.Name.IsProTrackName() == false)
{
newTrack = new Track(FileType.Guitar5, peTrack.Track.Name);
newTrack.Merge(sender.Track);
}
else
{
newTrack = peTrack.Track.Clone(sender.Track.FileType);
}
newTrack.Name = sender.Track.Name;
sender.Track.Sequence.Insert(GetInsertAt(), newTrack);
if (!ModifierKeys.HasFlag(Keys.Shift))
{
sender.Track.Sequence.Remove(sender.Track);
}
}
Refresh();
SetSelectedItem(newTrack, SelectedDifficulty);
t_TrackClicked(this, newTrack, SelectedDifficulty);
}
});
dragItem = null;
}
示例6: peTrack_DifficultyItemDropped
void peTrack_DifficultyItemDropped(PEMidiTrack sender, GuitarDifficulty difficulty, DragEventArgs e)
{
var o = e.GetDropObject<PETrackDifficulty>();
o.IfObjectNotNull(op =>
{
DoRequestBackup();
var messages = sender.Track.GetChanMessagesByDifficulty(difficulty);
sender.Track.Remove(messages);
var otrack = o.MidiTrack.Track;
var clonedTrack = otrack.CloneDifficulty(o.Difficulty, difficulty, sender.Track.FileType);
var clonedMessages = clonedTrack.GetChanMessagesByDifficulty(difficulty).ToList();
foreach(var msg in clonedMessages)
{
sender.Track.Insert(msg.AbsoluteTicks, msg.Clone());
}
SetSelectedItem(sender.Track, o.Difficulty);
TrackClicked.IfObjectNotNull(x => x(this, sender.Track.Sequence, sender.Track, difficulty));
});
}
示例7: panelTracks_DragDrop
private void panelTracks_DragDrop(object sender, DragEventArgs e)
{
var droppedPETrack = e.GetDropObject<PEMidiTrack>();
droppedPETrack.IfObjectNotNull(xx =>
{
if (droppedPETrack != sender)
{
DoRequestBackup();
Track newTrack = null;
if (Sequence == null)
{
var targetType = this.IsPro ? FileType.Pro : FileType.Guitar5;
var seq = new Sequence(targetType, droppedPETrack.Track.Sequence.Division);
this.sequence = seq;
if (!droppedPETrack.Track.IsTempo())
{
var tempo = droppedPETrack.Track.Sequence.Tracks.Where(x => x.IsTempo());
if (tempo.Any())
{
seq.AddTempo(tempo.First().ConvertToPro());
}
}
newTrack = droppedPETrack.Track.Clone(seq.FileType);
seq.Add(newTrack);
}
else
{
if (this.Sequence == droppedPETrack.Track.Sequence)
{
this.Sequence.MoveTrack(droppedPETrack.Track.GetTrackIndex(), GetInsertAt());
}
else
{
newTrack = droppedPETrack.Track.Clone(Sequence.FileType);
sequence.Insert(GetInsertAt(), newTrack);
if (!sequence.Tracks.Any(x => x.IsTempo()))
{
var tempo = droppedPETrack.Track.Sequence.Tracks.Where(x => x.IsTempo());
if (tempo.Any())
{
sequence.AddTempo(tempo.First().ConvertToPro());
}
}
}
}
CreatePanelTracks(this.sequence);
TrackAdded.IfObjectNotNull(tc => tc(this, this.sequence, newTrack, SelectedDifficulty));
}
});
dragItem = null;
}