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


C# DataObject.GetFileDropList方法代码示例

本文整理汇总了C#中System.Windows.Forms.DataObject.GetFileDropList方法的典型用法代码示例。如果您正苦于以下问题:C# DataObject.GetFileDropList方法的具体用法?C# DataObject.GetFileDropList怎么用?C# DataObject.GetFileDropList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.DataObject的用法示例。


在下文中一共展示了DataObject.GetFileDropList方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetFilePath

        /// <summary>
        /// Get the file path from a drag & drop operation info.
        /// Return null if it was not possibile to retrieve a file path (for instance 
        /// if the data format is not handled).
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public static string GetFilePath(this DragDropInfo info)
        {
            var data = new DataObject(info.Data);

            if (info.Data.GetDataPresent("FileDrop"))
            {
                // The drag and drop operation came from the file system
                var files = data.GetFileDropList();

                if (files != null && files.Count == 1)
                    return files[0];
            }
            else if (info.Data.GetDataPresent("CF_VSSTGPROJECTITEMS"))
                return data.GetText(); // The drag and drop operation came from the VS solution explorer
            else if (info.Data.GetDataPresent("MultiURL"))
                return data.GetText();

            return null;
        }
开发者ID:GProulx,项目名称:WebEssentials2013,代码行数:26,代码来源:DragDropExtensions.cs

示例2: GetImageFilename

        public static string GetImageFilename(DragDropInfo info)
        {
            DataObject data = new DataObject(info.Data);

            if (info.Data.GetDataPresent("FileDrop"))
            {
                // The drag and drop operation came from the file system
                StringCollection files = data.GetFileDropList();

                if (files != null && files.Count == 1)
                {
                    return files[0];
                }
            }
            else if (info.Data.GetDataPresent("CF_VSSTGPROJECTITEMS"))
            {
                // The drag and drop operation came from the VS solution explorer
                return data.GetText();
            }

            return null;
        }
开发者ID:Russe11,项目名称:WebEssentials2013,代码行数:22,代码来源:FontDrop.cs

示例3: TestFileDrop

		public void TestFileDrop ()
		{
			DataObject d = new DataObject ();
			StringCollection sc = new StringCollection ();
			
			sc.AddRange (new string[] {"A", "B", "C"});

			d.SetFileDropList (sc);

			Assert.AreEqual (false, d.ContainsAudio (), "A1");
			Assert.AreEqual (true, d.ContainsFileDropList (), "A2");
			Assert.AreEqual (false, d.ContainsImage (), "A3");
			Assert.AreEqual (false, d.ContainsText (), "A4");
			Assert.AreEqual (false, d.ContainsText (TextDataFormat.CommaSeparatedValue), "A5");

			Assert.AreEqual (sc.Count, d.GetFileDropList ().Count, "A6");
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:17,代码来源:DataObjectTest.cs

示例4: PrintFileList

        private static void PrintFileList(IDataObject dataObject)
        {
            var dataObjectHelper = new DataObject(dataObject);
            StringCollection fileDropList = dataObjectHelper.GetFileDropList();

            foreach (string filePath in fileDropList)
            {
                Console.Out.WriteLine(" - {0}", filePath);
            }

            Console.Out.WriteLine();
        }
开发者ID:qisope,项目名称:CSharpCOMServer,代码行数:12,代码来源:Program.cs

示例5: treeView_DragDrop

        private void treeView_DragDrop(object sender, DragEventArgs e)
        {
            DataObject o = new DataObject(e.Data);
            if (o.ContainsFileDropList()) {
                FileTreeNode node = (FileTreeNode)treeView.GetNodeAt(treeView.PointToClient(new Point(e.X, e.Y)));
                if (node != null && node.File.Type == FileSystemObjectType.Directory) {
                    StringCollection files = o.GetFileDropList();

                    Paste(node, files, e.Effect == DragDropEffects.Move ? false : true);
                }
            }
        }
开发者ID:greeduomacro,项目名称:phoenix,代码行数:12,代码来源:FileList.cs

示例6: LoadDataObject

        public bool LoadDataObject(object Src)
        {
            try
            {
                DataObject d = new DataObject(Src);

                if (d.ContainsImage())
                {
                    if (LoadImage(d.GetImage()))
                        return true;
                }

                if (d.ContainsFileDropList())
                {
                    foreach (string FName in d.GetFileDropList())
                    {
                        try
                        {
                            if (LoadImage(FName))
                                return true;

                        }
                        catch
                        {
                        }
                    }
                }

                if (d.ContainsText())
                {
                    string FName = d.GetText().Trim();

                    if ((FName.IndexOf("http://") == 0) ||
                        (FName.IndexOf("https://") == 0))
                    {
                        if (LoadImageFromUrl(FName))
                            return true;

                    }
                    else
                    {
                        if (File.Exists(FName))
                        {
                            if (LoadImage(FName))
                                return true;
                        }
                    }
                }
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.ToString());

            }
            return false;
        }
开发者ID:metropolian,项目名称:DmScrCap,代码行数:56,代码来源:FormEditor.cs


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