本文整理汇总了C#中System.Windows.DragEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# DragEventArgs类的具体用法?C# DragEventArgs怎么用?C# DragEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DragEventArgs类属于System.Windows命名空间,在下文中一共展示了DragEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: txtCode_Drop
private void txtCode_Drop(object sender, DragEventArgs e)
{
//open file which was drag&dropped.
/* if (e.Data.GetDataPresent(DataFormats.FileDrop))
{
//open only single file
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
if (files.Length == 1)
{
//warn user about wrong file extension
if (System.IO.Path.GetExtension(files[0]) != ".tex")
{
MessageBoxResult r = MessageBox.Show("File does not seem to be a LaTeX-file. Proceed opening?", "Wrong file extension", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.No);
if (r == MessageBoxResult.No)
return;
}
if (TryDisposeFile())
LoadFile(files[0]);
}
else
MessageBox.Show("Only one file at a time allowed via drag&drop.", "Too many files", MessageBoxButton.OK, MessageBoxImage.Information);
}*/
}
示例2: OnDrop
protected override void OnDrop(DragEventArgs e)
{
base.OnDrop(e);
if (e.Data.GetDataPresent(DataFormats.StringFormat))
{
string dataString = (string) e.Data.GetData(DataFormats.StringFormat);
BrushConverter converter = new BrushConverter();
if (converter.IsValid(dataString))
{
Brush newFill = (Brush) converter.ConvertFromString(dataString);
circleUI.Fill = newFill;
if (e.KeyStates.HasFlag(DragDropKeyStates.ControlKey))
{
e.Effects = DragDropEffects.Copy;
}
else
{
e.Effects = DragDropEffects.Move;
}
}
}
e.Handled = true;
}
示例3: InputDragDrop
public InputDragDrop(DragEventArgs e)
{
ObjectHasDataPresent = e.Data.GetDataPresent(DataFormats.FileDrop);
List<string> fsoPaths = ((string[])e.Data.GetData(DataFormats.FileDrop)).ToList();
initFSOPath(fsoPaths);
}
示例4: TreeViewDrop
void TreeViewDrop(object sender, DragEventArgs e)
{
TreeViewItem t = sender as TreeViewItem;
IStudioResourceRepository rep = StudioResourceRepository.Instance;
if(t != null)
{
ExplorerItemModel destination = t.Header as ExplorerItemModel;
if (destination != null)
{
var dataObject = e.Data;
if (dataObject != null && dataObject.GetDataPresent(GlobalConstants.ExplorerItemModelFormat))
{
var explorerItemModel = dataObject.GetData(GlobalConstants.ExplorerItemModelFormat);
try
{
ExplorerItemModel source = explorerItemModel as ExplorerItemModel;
if (ShouldNotMove(source, destination))
{
e.Handled = true;
}
else
{
MoveItem(source, destination, rep);
}
}
finally { e.Handled = true; }
}
}
}
}
示例5: UserControl_Drop
private void UserControl_Drop(object sender, DragEventArgs e)
{
if (this.mainContent.Content != null && this.mainContent.Content is Grid)
{
((Grid)this.mainContent.Content).ShowGridLines = false;
}
}
示例6: Grid_Drop
private void Grid_Drop(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
{
bool allGood = true;
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
foreach (string f in files)
{
if (System.IO.Path.GetExtension(f) == ".wad")
{
try
{
free(f);
}
catch (ArgumentException ex)
{
MessageBox.Show("Could not free the file. Try again.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
allGood = false;
}
}
else
{
MessageBox.Show("Not a WAD file.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
if (allGood)
MessageBox.Show("All files freed successfully.", "Success.", MessageBoxButton.OK, MessageBoxImage.Information);
else
MessageBox.Show("Not all files were successfull. Try again.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
示例7: SelectLogFileButton_DragEnter
private void SelectLogFileButton_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
e.Effects = DragDropEffects.Link;
else
e.Effects = DragDropEffects.None;
}
示例8: OnDragEnter
protected override void OnDragEnter(DragEventArgs e)
{
if (GetDraggingFileList(e.Data).Length > 0)
{
e.Effects = DragDropEffects.Copy;
}
}
示例9: ItemsControl_DragOver
private void ItemsControl_DragOver(object sender, DragEventArgs e)
{
// if (e.Data.GetDataPresent(typeof(Model)))
// {
// e.Effects = DragDropEffects.All;
// }
}
示例10: _tbDrop_Drop
private void _tbDrop_Drop(object sender, DragEventArgs e)
{
_ddh.DragDrop(sender, e);
e.Handled = true;
this._tbDrop.Text = _ddh.XmlText;
Clipboard.SetText(_ddh.XmlText);
}
示例11: Window_Drop
private void Window_Drop(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
{
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
if(files.Length > 0)
{
string file = files[0];
if(file.EndsWith(".hmap"))
{
if (machine.Mode == Machine.OperatingMode.Probe || Map != null)
return;
OpenHeightMap(file);
}
else
{
if (machine.Mode == Machine.OperatingMode.SendFile)
return;
try
{
machine.SetFile(System.IO.File.ReadAllLines(file));
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}
}
示例12: DragImage_Execute
private void DragImage_Execute(DragEventArgs args)
{
args.Effects = args.Data.GetDataPresent(DataFormats.FileDrop)
? DragDropEffects.Copy
: DragDropEffects.None;
args.Handled = true;
}
示例13: legend_Drop
private void legend_Drop(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent("legendLayerFormat"))
{
Layer moveLayer = e.Data.GetData("legendLayerFormat") as Layer;
var lvItem = legend.ContainerFromElement((FrameworkElement)e.OriginalSource) as ListViewItem;
if (lvItem != null)
{
Layer replaceLayer = lvItem.DataContext as Layer;
if (replaceLayer != null)
{
int index = mapView.Map.Layers.IndexOf(replaceLayer);
if (index >= 0)
{
mapView.Map.Layers.Remove(moveLayer);
mapView.Map.Layers.Insert(index, moveLayer);
}
else
{
mapView.Map.Layers.Remove(moveLayer);
mapView.Map.Layers.Add(moveLayer);
}
}
}
}
}
示例14: legend_DragEnter
private void legend_DragEnter(object sender, DragEventArgs e)
{
if (!e.Data.GetDataPresent("legendLayerFormat") || sender == e.Source)
{
e.Effects = DragDropEffects.None;
}
}
示例15: OnDrop
private void OnDrop(object sender, DragEventArgs e)
{
if (e.Data.GetFormats().Contains("GettingThingsDone.src.view.StaticListPanel") && this.AllowListDrop)
{
StaticListPanel source = e.Data.GetData(e.Data.GetFormats().First()) as StaticListPanel;
StaticListPanel target = e.Source as StaticListPanel;
var tmp = source.DataContext;
source.DataContext = target.DataContext;
target.DataContext = tmp;
return;
}
else if (e.Data.GetFormats().Contains(typeof(TaskMoveData).ToString()))
{
TaskMoveData data = e.Data.GetData(e.Data.GetFormats().First(), true) as TaskMoveData;
data.OrigList.removeTask(data.Task);
TaskList l = DataContext as TaskList;
l.AddTask(data.Task);
this.List.BorderThickness = new Thickness(0);
}
}