drag and drop - C# DragEnter event of the Winforms DragDrop -
Why do we really have to handle the drag destination event dragent?
What is the effect of this destination?
at source
Public Partial Classroom Toolbox: System.Windows.Forms.Form {Public ToolboxForm () {InitializeComponent (); } Private Zero lbl_MouseDown (Object Sender, System.Windows.Forms.MouseEventArgs e) {label lbl = (Label) Sender; Lbl.DoDragDrop (lbl.Image, DragDropEffects.Link); }}
at destination:
public partial square DrawingArea: form {public drawingia () {InitializeComponent (); } Private Zero DrawingArea_Load (Object Sender, System.EventArgs e) {ToolboxForm toolBoxForm = new ToolboxForm (); This.AddOwnedForm (toolBoxForm); ToolBoxForm.Show (); PictureBox1.AllowDrop = True; } Private Zero picDrawingArea_DragEnter (Object Sender, System.Windows.Forms.DragEventArgs e) {if (e.Data.GetDataPresent (DataFormats.Bitmap)) {e.ffect = DragDropEffects.Copy; } And {e. Effect = drag effect; }} Private Zero picDrawingArea_DragDrop (Object Sender, System.Windows.Forms.DragEventArgs e) {Graphics G = pictureBox1.CreateGraphics (); G.DrawImage (image) E. Data. GetData (DataFormats.Bitmap), new point (E.X - this. Lift-12, E.I. - Top-30)); }}
When I am commenting on the code:
if (e.Data.GetDataPresent (DataFormats.Bitmap)) {e.ffect = DragDropEffects .Copy; } And {e. Effect = drag effect; }
The image is not being omitted.
From
Name < Code>
any
Copy
From:
MembersName < Code>
details any
The drop target does not accept data. Copy
Data is copied from the drag source to the drop target. <
Data from drag source is moved to the drop target.
Link
is linked to the data drop target from the drag source .
> You can scroll to
; The target can be scrolled while dragging to detect drop down, which is not currently visible in the target.
All
odi>
copy, Combination of move and scroll effects
So if you want to accept the drop, you have to set it apart from any
.
However, the next quote assures me that it was used only for feedback:
You can display various mouse pointers for drag-and-drop operations You can use DragDropEffects for. For example, you can display a plus sign for a copy drag-and-drop operation, a Move drag-and-drop operation, or a red circle An arrow for any with a line through it for drag-and-drop operation.
Comments
Post a Comment