संपादित करें

इसके माध्यम से साझा किया गया


ToolStripItem.DoDragDrop Method

Definition

Overloads

DoDragDrop(Object, DragDropEffects)

Begins a drag-and-drop operation.

DoDragDrop(Object, DragDropEffects, Bitmap, Point, Boolean)

Begins a drag operation.

DoDragDrop(Object, DragDropEffects)

Begins a drag-and-drop operation.

public:
 System::Windows::Forms::DragDropEffects DoDragDrop(System::Object ^ data, System::Windows::Forms::DragDropEffects allowedEffects);
public System.Windows.Forms.DragDropEffects DoDragDrop (object data, System.Windows.Forms.DragDropEffects allowedEffects);
member this.DoDragDrop : obj * System.Windows.Forms.DragDropEffects -> System.Windows.Forms.DragDropEffects
Public Function DoDragDrop (data As Object, allowedEffects As DragDropEffects) As DragDropEffects

Parameters

data
Object

The object to be dragged.

allowedEffects
DragDropEffects

The drag operations that can occur.

Returns

One of the DragDropEffects values.

Remarks

If the drag operation needs to interact with applications in another process, the data parameter must either be a base managed class (such as System.String, System.Drawing.Bitmap, or System.Drawing.Imaging.Metafile), an object that implements System.Runtime.Serialization.ISerializable, or an object that implements IDataObject.

Applies to

DoDragDrop(Object, DragDropEffects, Bitmap, Point, Boolean)

Begins a drag operation.

public:
 System::Windows::Forms::DragDropEffects DoDragDrop(System::Object ^ data, System::Windows::Forms::DragDropEffects allowedEffects, System::Drawing::Bitmap ^ dragImage, System::Drawing::Point cursorOffset, bool useDefaultDragImage);
public System.Windows.Forms.DragDropEffects DoDragDrop (object data, System.Windows.Forms.DragDropEffects allowedEffects, System.Drawing.Bitmap dragImage, System.Drawing.Point cursorOffset, bool useDefaultDragImage);
public System.Windows.Forms.DragDropEffects DoDragDrop (object data, System.Windows.Forms.DragDropEffects allowedEffects, System.Drawing.Bitmap? dragImage, System.Drawing.Point cursorOffset, bool useDefaultDragImage);
member this.DoDragDrop : obj * System.Windows.Forms.DragDropEffects * System.Drawing.Bitmap * System.Drawing.Point * bool -> System.Windows.Forms.DragDropEffects
Public Function DoDragDrop (data As Object, allowedEffects As DragDropEffects, dragImage As Bitmap, cursorOffset As Point, useDefaultDragImage As Boolean) As DragDropEffects

Parameters

data
Object
allowedEffects
DragDropEffects
dragImage
Bitmap
cursorOffset
Point
useDefaultDragImage
Boolean

Returns

A value from the DragDropEffects enumeration that represents the final effect that was performed during the drag-and-drop operation.

Remarks

The allowedEffects parameter determines which drag operations can occur. If the drag operation needs to interop with applications in another process, data should either be a base managed class (String, Bitmap, or Metafile) or some Object that implements ISerializable. data can also be any Object that implements IDataObject. dragImage is the bitmap that will be displayed during the drag operation and cursorOffset specifies the location of the cursor within dragImage, which is an offset from the upper-left corner. Specify true for useDefaultDragImage to use a layered window drag image with a size of 96x96; otherwise false. Note the outer edges of dragImage are blended out if the image width or height exceeds 300 pixels.

Because DoDragDrop(Object, DragDropEffects, Bitmap, Point, Boolean) always performs the RGB multiplication step in calculating the alpha value, you should always pass a Bitmap without premultiplied alpha blending. No error will result from passing a Bitmap with premultiplied alpha blending, but this method will multiply it again, doubling the resulting alpha value.

Applies to