示例#1
0
        private void LauncherForm_DragOver(object sender, DragEventArgs e)
        {
            IDataObject dataObject = e.Data;

            if (!dataObject.GetDataPresent(DataFormats.FileDrop))
            {
                e.Effect = DragDropEffects.None;
                return;
            }

            string[] files = (string[])dataObject.GetData(DataFormats.FileDrop);

            e.Effect = FormatFactory.IsOpenable(files[0]) ? DragDropEffects.Move : DragDropEffects.None;
        }
示例#2
0
        private void LauncherForm_DragDrop(object sender, DragEventArgs e)
        {
            IDataObject dataObject = e.Data;

            if (!dataObject.GetDataPresent(DataFormats.FileDrop))
            {
                return;
            }

            string filename = ((string[])dataObject.GetData(DataFormats.FileDrop))[0];

            if (!FormatFactory.IsOpenable(filename))
            {
                return;
            }

            AddItem(filename);
        }