当前位置: 首页>>代码示例>>C#>>正文


C# Windows.DragEventArgs类代码示例

本文整理汇总了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);

            }*/

        }
开发者ID:JoeyEremondi,项目名称:tikzedt,代码行数:25,代码来源:DocumentView.xaml.cs

示例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;
        }
开发者ID:cgideon,项目名称:CSharpSandbox,代码行数:26,代码来源:Circle.xaml.cs

示例3: InputDragDrop

        public InputDragDrop(DragEventArgs e)
        {
            ObjectHasDataPresent = e.Data.GetDataPresent(DataFormats.FileDrop);
            List<string> fsoPaths = ((string[])e.Data.GetData(DataFormats.FileDrop)).ToList();

            initFSOPath(fsoPaths);
        }
开发者ID:kirsbo,项目名称:Ark,代码行数:7,代码来源:InputDragDrop.cs

示例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; }
             }
         }
     }
 }
开发者ID:Robin--,项目名称:Warewolf,代码行数:30,代码来源:ExplorerView.xaml.cs

示例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;
     }
 }
开发者ID:No3x,项目名称:YAHW,代码行数:7,代码来源:TilePage.xaml.cs

示例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);
     }
 }
开发者ID:VytenisJ,项目名称:FreeThatRom,代码行数:31,代码来源:MainWindow.xaml.cs

示例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;
 }
开发者ID:RobertCL,项目名称:ArdulogAltitudeLogger,代码行数:7,代码来源:MainWindow.xaml.cs

示例8: OnDragEnter

 protected override void OnDragEnter(DragEventArgs e)
 {
     if (GetDraggingFileList(e.Data).Length > 0)
     {
         e.Effects = DragDropEffects.Copy;
     }
 }
开发者ID:vboctor,项目名称:MantisSubmit,代码行数:7,代码来源:AttachmentListBox.cs

示例9: ItemsControl_DragOver

 private void ItemsControl_DragOver(object sender, DragEventArgs e)
 {
     //            if (e.Data.GetDataPresent(typeof(Model)))
     //            {
     //                e.Effects = DragDropEffects.All;
     //            }
 }
开发者ID:markrendle,项目名称:WpfPrimitives,代码行数:7,代码来源:MainWindow.xaml.cs

示例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);
 }
开发者ID:jithuin,项目名称:infogeezer,代码行数:7,代码来源:NotesDragDropTextBox.xaml.cs

示例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);
						}
					}
				}
			}
		}
开发者ID:martin2250,项目名称:OpenCNCPilot,代码行数:34,代码来源:MainWindow.xaml.cs

示例12: DragImage_Execute

 private void DragImage_Execute(DragEventArgs args)
 {
     args.Effects = args.Data.GetDataPresent(DataFormats.FileDrop)
                        ? DragDropEffects.Copy
                        : DragDropEffects.None;
     args.Handled = true;
 }
开发者ID:cedianoost,项目名称:3DS-Theme-Editor,代码行数:7,代码来源:MainWindow.Images.cs

示例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);
                        }
                    }
                }
            }
        }
开发者ID:KrisFoster44,项目名称:arcgis-runtime-samples-dotnet,代码行数:27,代码来源:LayerList.xaml.cs

示例14: legend_DragEnter

 private void legend_DragEnter(object sender, DragEventArgs e)
 {
     if (!e.Data.GetDataPresent("legendLayerFormat") || sender == e.Source)
     {
         e.Effects = DragDropEffects.None;
     }
 }
开发者ID:KrisFoster44,项目名称:arcgis-runtime-samples-dotnet,代码行数:7,代码来源:LayerList.xaml.cs

示例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);
            }
        }
开发者ID:AlexPerrot,项目名称:GettingThingsDone,代码行数:27,代码来源:StaticListPanel.xaml.cs


注:本文中的System.Windows.DragEventArgs类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。