Beispiel #1
0
        /// <summary>
        /// Notifies the DragDropHelper that the specified Control received
        /// a DragEnter event.
        /// </summary>
        /// <param name="control">The Control the received the DragEnter event.</param>
        /// <param name="data">The DataObject containing a drag image.</param>
        /// <param name="cursorOffset">The current cursor's offset relative to the window.</param>
        /// <param name="effect">The accepted drag drop effect.</param>
        public static void DragEnter(Control control, IDataObject data, System.Drawing.Point cursorOffset, DragDropEffects effect)
        {
            IntPtr controlHandle = IntPtr.Zero;

            if (control != null)
            {
                controlHandle = control.Handle;
            }
            Win32Point pt = SwfDragDropLibExtensions.ToWin32Point(cursorOffset);

            s_instance.DragEnter(controlHandle, (ComIDataObject)data, ref pt, (int)effect);
            s_dataContext[control] = data;
        }
Beispiel #2
0
        /// <summary>
        /// Notifies the DragDropHelper that the current Control received
        /// a DragOver event.
        /// </summary>
        /// <param name="data">The DataObject containing a drag image.</param>
        /// <param name="cursorOffset">The current cursor's offset relative to the window.</param>
        /// <param name="effect">The accepted drag drop effect.</param>
        public static void Drop(IDataObject data, System.Drawing.Point cursorOffset, DragDropEffects effect)
        {
            // No need to clear the drop description, but don't keep it stored to avoid memory leaks
            foreach (KeyValuePair <Control, IDataObject> pair in s_dataContext)
            {
                if (object.ReferenceEquals(pair.Value, data))
                {
                    s_dataContext.Remove(pair);
                    break;
                }
            }

            Win32Point pt = SwfDragDropLibExtensions.ToWin32Point(cursorOffset);

            s_instance.Drop((ComIDataObject)data, ref pt, (int)effect);
        }
Beispiel #3
0
        /// <summary>
        /// Notifies the DragDropHelper that the current Control received
        /// a DragOver event.
        /// </summary>
        /// <param name="cursorOffset">The current cursor's offset relative to the window.</param>
        /// <param name="effect">The accepted drag drop effect.</param>
        public static void DragOver(System.Drawing.Point cursorOffset, DragDropEffects effect)
        {
            Win32Point pt = SwfDragDropLibExtensions.ToWin32Point(cursorOffset);

            s_instance.DragOver(ref pt, (int)effect);
        }