RichTextBox.AllowDrop Property

Gets or sets a value indicating whether the control will enable drag-and-drop operations.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

[<BrowsableAttribute(false)>]
abstract AllowDrop : bool with get, set
[<BrowsableAttribute(false)>]
override AllowDrop : bool with get, set

Property Value

Type: System.Boolean
true if drag-and-drop is enabled in the control; otherwise, false.

The following code example demonstrates how to perform drag-and-drop operations using a ListBox control that contains items to drop into a RichTextBox control. The constructor of the form sets the AllowDrop property to true to enable drag-and-drop operations to occur in the RichTextBox. The example uses the MouseDown event of the ListBox to start the drag operation by calling the DoDragDrop method. The example uses the DragEnter event to determine if an item being dragged into the RichTextBox is a valid data type. The DragDrop event performs the actual dropping of a dragged item into the RichTextBox control at the current cursor location within the RichTextBox. This example requires that the DragDrop and DragEnter events have been connected to the event handlers defined in the example.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft