* Merge winforms framework content to working branch (#14) * Breadcrumb / TOC / Move net5 to net folder (#15) * change path from net5 to net * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Add .net 5 winforms placeholder article (#16) * added some metadata and adjusted net5 placeholder * corrections * corrections * corrections * Test1 * Swapping landing page vs concept * fix links * Fix links * Fix desc
2.9 KiB
title, ms.date, helpviewer_keywords, ms.assetid
| title | ms.date | helpviewer_keywords | ms.assetid | |
|---|---|---|---|---|
| How to: Perform Drag-and-Drop Operations Between Applications | 03/30/2017 |
|
fa347436-2b12-4dd6-8507-59d7241f6a06 |
How to: Perform Drag-and-Drop Operations Between Applications
Performing drag-and-drop operations between applications is no different than enabling this action within an application, as long as both applications involved behave according to the "contract" established between the xref:System.Windows.Forms.DragEventArgs.AllowedEffect%2A and xref:System.Windows.Forms.DragEventArgs.Effect%2A properties.
In the following procedure, you will use a Windows-based application you create and the WordPad word processor that is included with the Windows operating system to perform drag-and-drop operations between applications. WordPad has a certain set of allowed effects for text being dragged and dropped; the Windows-based application you will write code for will work with these effects so that drag-and-drop operations may be completed successfully.
To perform a drag-and-drop procedure between applications
-
Create a new Windows Forms application.
-
Add a xref:System.Windows.Forms.TextBox control to your form.
-
Configure the xref:System.Windows.Forms.TextBox control to receive dropped data.
For more information, see Walkthrough: Performing a Drag-and-Drop Operation in Windows Forms.
-
Run your Windows-based application, and while the application is running, run WordPad.
WordPad is a text editor installed by Windows that allows drag-and-drop operations. It is accessible by pressing the Start button, selecting Run, and then typing
WordPadinto the text box of the Run dialog box and clicking OK. -
Once WordPad is open, type a string of text into it.
-
Using the mouse, select the text, and then drag the selected text over to the xref:System.Windows.Forms.TextBox control in your Windows-based application.
Observe that when you mouse over the xref:System.Windows.Forms.TextBox control (and, consequently, raise the xref:System.Windows.Forms.Control.DragEnter event), the cursor changes, and you can drop the selected text into the xref:System.Windows.Forms.TextBox control.
Additionally, you can configure your xref:System.Windows.Forms.TextBox control to allow text strings to be dragged and dropped into WordPad. For more information, see Walkthrough: Performing a Drag-and-Drop Operation in Windows Forms.