/// <summary> /// Triggered when a new handler is being dragged to the handler list /// </summary> /// <param name="sender">Sender object</param> /// <param name="eventArgs">Event arguments</param> private void OnHandlerDragEnter(object sender, DragEventArgs eventArgs) { // make sure we've got valid data if (eventArgs.Data.GetDataPresent(DataFormats.Serializable, true) && eventArgs.Data.GetData(DataFormats.Serializable) is List <string> typeList) { // TODO: localize this string descriptionMessage = typeList.Count == 1 ? "Add handler" : "Add %1"; string descriptionInsert = typeList.Count == 1 ? String.Empty : $"{typeList.Count} handlers"; eventArgs.Effect = eventArgs.AllowedEffect & DragDropEffects.Copy; DropTargetHelper.DragEnter(this.handlerDropTargetPanel, eventArgs.Data, new Point(eventArgs.X, eventArgs.Y), eventArgs.Effect, descriptionMessage, descriptionInsert); } else { // no valid data received eventArgs.Effect = DragDropEffects.None; DropTargetHelper.DragEnter(this.handlerDropTargetPanel, eventArgs.Data, new Point(eventArgs.X, eventArgs.Y), eventArgs.Effect); } }
protected override void OnDragLeave(DragEventArgs e) { base.OnDragLeave(e); e.Effects = e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.Copy : DragDropEffects.None; e.Handled = true; #if !USE_STANDARD_DRAGDROP DropTargetHelper.DragLeave(e.Data); #endif }
protected override void OnDragLeave(DragEventArgs e) { base.OnDragLeave(e); e.Effects = e.Data.GetDataPresent(DataFormats.FileDrop) && !(ServiceProvider.ViewManager.Dialog is EmbeddedBrowserControl) ? DragDropEffects.Copy : DragDropEffects.None; e.Handled = true; #if !USE_STANDARD_DRAGDROP DropTargetHelper.DragLeave(e.Data); #endif }
private void tvwFiles_DragEnter(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) { e.Effect = e.AllowedEffect & DragDropEffects.Copy; DropTargetHelper.DragEnter(tvwFiles, e.Data, new Point(e.X, e.Y), e.Effect, "Copy to %1", "Here"); } else { e.Effect = DragDropEffects.None; DropTargetHelper.DragEnter(tvwFiles, e.Data, new Point(e.X, e.Y), e.Effect); } }
protected override void OnDrop(DragEventArgs e) { base.OnDrop(e); if (!DragContainer.IsInDrag && !(ServiceProvider.ViewManager.Dialog is EmbeddedBrowserControl)) { string[] fileNames = e.Data.GetData(DataFormats.FileDrop) as string[]; DoDrop(fileNames); } #if !USE_STANDARD_DRAGDROP DropTargetHelper.Drop(e.Data, e.GetPosition(this), DragDropEffects.Copy); #endif }
protected override void OnDragEnter(DragEventArgs e) { base.OnDragEnter(e); e.Effects = (e.Data.GetDataPresent(DataFormats.FileDrop)) ? DragDropEffects.Copy : DragDropEffects.None; e.Handled = true; #if !USE_STANDARD_DRAGDROP DropTargetHelper.DragEnter(this, e.Data, e.GetPosition(this), e.Effects); #endif }
protected override void OnDrop(DragEventArgs e) { base.OnDrop(e); if (!DragContainer.IsInDrag) { string[] fileNames = e.Data.GetData(DataFormats.FileDrop) as string[]; ((MainWindow)Application.Current.MainWindow).DoDrop(fileNames); Close(); //((MainWindow)Application.Current.MainWindow).HideMiniMode(); } #if !USE_STANDARD_DRAGDROP DropTargetHelper.Drop(e.Data, e.GetPosition(this), DragDropEffects.Copy); #endif }
protected override void OnDragDrop(DragEventArgs drgevent) { DropTargetHelper.Drop(drgevent.Data, GetPoint(drgevent), drgevent.Effect); base.OnDragDrop(drgevent); var droppedFiles = drgevent.Data.GetData(DataFormats.FileDrop) as string[]; if (droppedFiles?.Length > 0) { var files = droppedFiles .Select(path => Directory.Exists(path) ? FileUtility.GetDirectoryFiles(path) : (new[] { path })) .SelectMany(path => path) .FilterFileExtension(); this.AddFiles(files); } }
protected override void OnDragEnter(DragEventArgs drgevent) { var formats = drgevent.Data.GetFormats(); if (!this.IsRunning && drgevent.Data.GetDataPresent(DataFormats.FileDrop)) { drgevent.Effect = DragDropEffects.Copy; } else { drgevent.Effect = DragDropEffects.None; } DropTargetHelper.DragEnter(this, drgevent.Data, GetPoint(drgevent), drgevent.Effect, "チャプター一覧に追加", null); base.OnDragEnter(drgevent); }
protected override void OnDrop(DragEventArgs e) { base.OnDrop(e); if (!DragContainer.IsInDrag) { string[] fileNames = e.Data.GetData(DataFormats.FileDrop) as string[]; List <string> imageFiles = PhotoUploadWizard.FindImageFiles(fileNames); if (imageFiles.Count != 0) { PhotoUploadWizard.Show(imageFiles); } #if !USE_STANDARD_DRAGDROP DropTargetHelper.Drop(e.Data, e.GetPosition(this), DragDropEffects.Copy); #endif } }
private void tvwFiles_DragDrop(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) { e.Effect = e.AllowedEffect & DragDropEffects.Copy; } else { e.Effect = DragDropEffects.None; } DropTargetHelper.Drop(e.Data, new Point(e.X, e.Y), e.Effect); TreeNode nodeAt = tvwFiles.GetNodeAt(tvwFiles.PointToClient(new Point(e.X, e.Y))); if (e.Effect == DragDropEffects.Copy && nodeAt != null) { AcceptFileDrop(nodeAt, e.Data); } }
protected override void OnDrop(DragEventArgs e) { e.Effects = DragDropEffects.Copy; DropTargetHelper.Drop(e.Data, e.GetPosition(this), e.Effects); e.Handled = true; string[] files = null; try { files = (string[])e.Data.GetDataEx("FileNameW"); } catch (Exception ex) { this.Log().InfoException("Something weird happened on drop", ex); } if (files == null || files.Length != 1 || !Directory.Exists(files[0])) { UserError.Throw("Drop a directory onto the window"); return; } MessageBus.Current.SendMessage(files[0], "DropFolder"); }
/// <summary> /// Handles the drag enter event. /// </summary> /// <param name="sender">The sender for the event.</param> /// <param name="e">Event argument for the drag & drop operation.</param> public static void OnDragEnter(Control control, DragEventArgs e, string descriptionMessage, ICollection <string> items) { //Replace the C# {0} with the %1 used by Windows. descriptionMessage = descriptionMessage.Replace("{0}", "%1"); string descriptionInsert = string.Empty; string descriptionItemFormat = S._("{0}, "); foreach (string item in items) { if (descriptionInsert.Length < 259 && (descriptionInsert.Length < 3 || descriptionInsert.Substring(descriptionInsert.Length - 3) != "...")) { string append = string.Format(CultureInfo.InvariantCulture, descriptionItemFormat, item); if (descriptionInsert.Length + append.Length > 259) { descriptionInsert += "....."; } else { descriptionInsert += append; } } } if (!string.IsNullOrEmpty(descriptionInsert)) { descriptionInsert = descriptionInsert.Remove(descriptionInsert.Length - 2); } if (e.Data.GetDataPresent("DragImageBits")) { DropTargetHelper.DragEnter(control, e.Data, new Point(e.X, e.Y), e.Effect, descriptionMessage, descriptionInsert); } }
private void tvwFiles_DragOver(object sender, DragEventArgs e) { TreeNode nodeAt = tvwFiles.GetNodeAt(tvwFiles.PointToClient(new Point(e.X, e.Y))); bool fileDrop = (e.Data.GetDataPresent(DataFormats.FileDrop)); if (nodeAt != null || fileDrop) { if (nodeAt != null) { if (nodeAt != previousDragOver) { if (nodeAt.Tag is FileType) { tvwFiles.SetInsertionMark(nodeAt.Parent, explorerTreeView.InsertType.InsideNode); e.Data.SetDropDescription(DropImageType.Copy, "Zu %1 hinzufügen", nodeAt.Parent.Text); } else { tvwFiles.SetInsertionMark(nodeAt, explorerTreeView.InsertType.InsideNode); e.Data.SetDropDescription(DropImageType.Copy, "Zu %1 hinzufügen", nodeAt.Text); } } } previousDragOver = nodeAt; e.Effect = e.AllowedEffect & DragDropEffects.Copy; } else { e.Effect = DragDropEffects.None; tvwFiles.SetInsertionMark(null, explorerTreeView.InsertType.BeforeNode); e.Data.DisableDropDescription(); e.Effect = DragDropEffects.None; DropTargetHelper.DragOver(new Point(e.X, e.Y), e.Effect); previousDragOver = null; } DropTargetHelper.DragOver(new Point(e.X, e.Y), e.Effect); }
private void scheduler_DragLeave(object sender, EventArgs e) { DropTargetHelper.DragLeave(this); }
private void scheduler_DragOver(object sender, DragEventArgs e) { DropTargetHelper.DragOver(new Point(e.X, e.Y), e.Effect); }
protected override void OnDragLeave(DragEventArgs e) { DropTargetHelper.DragLeave(); e.Handled = true; }
private void data_DragLeave(object sender, EventArgs e) { DropTargetHelper.DragLeave((Control)sender); }
/// <inheritdoc /> /// <summary>Raises the <see cref="E:System.Windows.Forms.Control.DragLeave" /> event.</summary> /// <param name="eventArgs">An <see cref="T:System.EventArgs" /> that contains the event data. </param> protected override void OnDragLeave(EventArgs eventArgs) { DropTargetHelper.DragLeave(this); base.OnDragLeave(eventArgs); }
protected override void OnDragOver(DragEventArgs e) { e.Effects = DragDropEffects.Copy; DropTargetHelper.DragOver(e.GetPosition(this), e.Effects); e.Handled = true; }
private void tvwFiles_DragLeave(object sender, EventArgs e) { DropTargetHelper.DragLeave(tvwFiles); ((explorerTreeView)sender).SetInsertionMark(null, explorerTreeView.InsertType.AfterNode); previousDragOver = null; }
/// <summary> /// Triggered when the handler list drop target is left /// </summary> /// <param name="sender">Sender object</param> /// <param name="eventArgs">Event arguments</param> private void OnHandlerListDragLeave(object sender, EventArgs eventArgs) { DropTargetHelper.DragLeave(this); }
/// <summary> /// Triggered when an item is being dragged over the handler list /// </summary> /// <param name="sender">Sender object</param> /// <param name="eventArgs">Event arguments</param> private void OnHandlerListDragOver(object sender, DragEventArgs eventArgs) { eventArgs.Effect = DragDropEffects.None; DropTargetHelper.DragOver(new Point(eventArgs.X, eventArgs.Y), eventArgs.Effect); }
/// <inheritdoc /> /// <summary>Raises the <see cref="E:System.Windows.Forms.Control.DragOver" /> event.</summary> /// <param name="eventArgs">A <see cref="T:System.Windows.Forms.DragEventArgs" /> that contains the event data. </param> protected override void OnDragOver(DragEventArgs eventArgs) { eventArgs.Effect = DragDropEffects.None; DropTargetHelper.DragOver(new Point(eventArgs.X, eventArgs.Y), eventArgs.Effect); base.OnDragOver(eventArgs); }
/// <summary> /// Triggered when a handler item is being dragged over the handler list region /// </summary> /// <param name="sender">Sender object</param> /// <param name="eventArgs">Event arguments</param> private void OnHandlerDragOver(object sender, DragEventArgs eventArgs) { DropTargetHelper.DragOver(new Point(eventArgs.X, eventArgs.Y), eventArgs.AllowedEffect & DragDropEffects.Copy); }
/// <summary> /// Triggered when the dragged item leaves the handler list region /// </summary> /// <param name="sender">Sender object</param> /// <param name="eventArgs">Event arguments</param> private void OnHandlerDragLeave(object sender, EventArgs eventArgs) { DropTargetHelper.DragLeave(this.handlerDropTargetPanel); }
protected override void OnDragOver(DragEventArgs drgevent) { DropTargetHelper.DragOver(GetPoint(drgevent), drgevent.Effect); base.OnDragOver(drgevent); }
public static void OnDrop(DragEventArgs e) { DropTargetHelper.Drop(e.Data, new Point(e.X, e.Y), e.Effect); }
protected override void OnDragDrop(DragEventArgs drgevent) { DropTargetHelper.Drop(drgevent.Data, new Point(drgevent.X, drgevent.Y), DragDropEffects.None); base.OnDragDrop(drgevent); }