ToolStripItem.DoDragDrop 方法

定義

多載

DoDragDrop(Object, DragDropEffects)

開始拖放作業。

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

開始拖曳作業。

DoDragDrop(Object, DragDropEffects)

開始拖放作業。

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

參數

data
Object

要拖曳的物件。

allowedEffects
DragDropEffects

可以發生的拖曳作業。

傳回

其中一個 DragDropEffects 值。

備註

如果拖曳作業需要在另一個進程中與應用程式互動, data 參數必須是基底 Managed 類別 (,例如 System.StringSystem.Drawing.BitmapSystem.Drawing.Imaging.Metafile) 、實 System.Runtime.Serialization.ISerializable作 的物件,或是實作 IDataObject的物件。

適用於

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

開始拖曳作業。

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

參數

data
Object
allowedEffects
DragDropEffects
dragImage
Bitmap
cursorOffset
Point
useDefaultDragImage
Boolean

傳回

源自 DragDropEffects 列舉的值,表示在拖放作業時執行最後的結果。

備註

參數 allowedEffects 會決定可發生的拖曳作業。 如果拖曳作業需要在另一個進程中與應用程式互操作, data 則應該是基底 Managed 類別, (StringBitmapMetafile) 或 Object 實作 的部分 ISerializabledata也可以是實作 IDataObject的任何 ObjectdragImage 是將在拖曳作業期間顯示的點陣圖,並 cursorOffset 指定游標在 內 dragImage的位置,這是左上角的位移。 指定 trueuseDefaultDragImage 以使用大小為 96x96 的分層視窗拖曳影像,否則 false為 。 請注意,如果影像寬度或高度超過 300 像素,則會混合的 外部邊緣 dragImage

由於 DoDragDrop(Object, DragDropEffects, Bitmap, Point, Boolean) 一律會在計算 Alpha 值時執行 RGB 乘法步驟,因此您應該一律傳遞 ,而不需 Bitmap 預先乘法 Alpha 混合。 傳遞具有預乘 Alpha 混合的 ,不會產生任何錯誤 Bitmap ,但這個方法會再次相乘,將產生的 Alpha 值加倍。

適用於