コード例 #1
0
ファイル: ClipsListBox.cs プロジェクト: jmfrouin/clipboards
        private void ClipsDragOver(object sender, DragEventArgs e)
        {
            /*fIndexOfItemUnderMouseToDrop = listBoxClips.IndexFromPoint(listBoxClips.PointToClient(new Point(e.X, e.Y)));
             *
             * if (fIndexOfItemUnderMouseToDrop != ListBox.NoMatches)
             * {
             * listBoxClips.SelectedIndex = fIndexOfItemUnderMouseToDrop;
             * }
             * else
             * {*/
            SelectedIndex = 0;
            //}

            /*if (e.Effect == DragDropEffects.Move)
             * listBoxClips.Items.Remove((string)e.Data.GetData(DataFormats.Text));*/

#if ADVANCED_DRAG_AND_DROP
            Point      p = Cursor.Position;
            Win32Point wp;
            wp.x = p.X;
            wp.y = p.Y;
            IDropTargetHelper dropHelper = (IDropTargetHelper) new DragDropHelper();
            dropHelper.DragOver(ref wp, (int)e.Effect);
#endif
        }
コード例 #2
0
        public void Drag_Over(DragEventArgs e)
        {
            if (e.Data.GetDataPresent(DataFormats.FileDrop) ||
                e.Data.GetDataPresent("HTML Format") ||
                e.Data.GetDataPresent(DataFormats.Text) ||
                e.Data.GetDataPresent("UniformResourceLocator")
                )
            {
                e.Effect = DragDropEffects.Copy;

                try
                {
                    Point      _p = Cursor.Position;
                    Win32Point _wp;
                    _wp.x = _p.X;
                    _wp.y = _p.Y;
                    IDropTargetHelper _dropHelper = (IDropTargetHelper) new DragDropHelper();
                    _dropHelper.DragOver(ref _wp, (int)e.Effect);
                }
                catch
                {
                }
            }
            else
            {
                e.Effect = DragDropEffects.None; // Unknown data, ignore it
            }
        }
コード例 #3
0
 /// <summary>
 /// Bring the Drag Icon visual at the mouse position
 /// </summary>
 public void UpdatePosition()
 {
     if (WPF.GetCursorPos(out WPF.SysPoint spos))
     {
         DDHelper.DragOver(ref spos, Effects);
     }
 }
コード例 #4
0
        protected virtual void OnDragOver(DragEventArgs e, FrameworkElement element)
        {
            Win32Point wp;

            System.Windows.Point p = e.GetPosition(element);
            wp.x = (int)p.X;
            wp.y = (int)p.Y;
            _DropTargetHelper.DragOver(ref wp, (int)e.Effects);
        }
コード例 #5
0
    public static void ProcessDragOver(DragEventArgs e)
    {
        Point        point = Cursor.Position;
        WindowsPoint winpoint;

        winpoint.X = point.X;
        winpoint.Y = point.Y;
        IDropTargetHelper dropHelper = (IDropTargetHelper) new DragDropHelper();

        dropHelper.DragOver(ref winpoint, (int)e.Effect);
    }
コード例 #6
0
        protected void control_OnDragOver(object sender, DragEventArgs e)
        {
            e.Effect = DragDropEffects.Copy;
            Point      p = Cursor.Position;
            Win32Point wp;

            wp.x = p.X;
            wp.y = p.Y;
            IDropTargetHelper dropHelper = (IDropTargetHelper) new DragDropHelper();

            dropHelper.DragOver(ref wp, (int)e.Effect);
        }
コード例 #7
0
ファイル: Form1.cs プロジェクト: sportflier/excel2qif
        private void dataGridView1_DragOver(object sender, DragEventArgs e)
        {
            e.Effect = DragDropEffects.Copy;
            Point      p = Cursor.Position;
            Win32Point wp;

            wp.x = p.X;
            wp.y = p.Y;
            IDropTargetHelper dropHelper = (IDropTargetHelper) new DragDropHelper();

            dropHelper.DragOver(ref wp, (int)e.Effect);
        }
コード例 #8
0
        protected override void OnDragOver(DragEventArgs e)
        {
            Win32Point wp;

            e.Effects = DragDropEffects.Copy;
            Point p = e.GetPosition(this);

            wp.x = (int)p.X;
            wp.y = (int)p.Y;
            IDropTargetHelper dropHelper = (IDropTargetHelper) new DragDropHelper();

            dropHelper.DragOver(ref wp, (int)e.Effects);
        }
コード例 #9
0
        public int DragOver(ShellAPI.MK grfKeyState, ShellAPI.POINT pt, ref DragDropEffects pdwEffect)
        {
            bool reset = false;

            #region Get DropItem

            Point point = br.FileView.PointToClient(new Point(pt.x, pt.y));
            ListViewHitTestInfo hitTest = br.FileView.HitTest(point);
            if (hitTest.Item != null &&
                (br.FileView.View != View.Details || hitTest.SubItem == null || hitTest.Item.Name == hitTest.SubItem.Name) &&
                (hitTest.Location == ListViewHitTestLocations.Image ||
                 hitTest.Location == ListViewHitTestLocations.Label ||
                 hitTest.Location == ListViewHitTestLocations.StateImage))
            {
                if (!hitTest.Item.Equals(dropListItem))
                {
                    if (dropTarget != null)
                    {
                        dropTarget.DragLeave();
                    }

                    ReleaseCom();

                    if (dropListItem != null)
                    {
                        dropListItem.Selected = wasSelected;
                    }

                    dropListItem          = hitTest.Item;
                    wasSelected           = dropListItem.Selected;
                    dropListItem.Selected = true;

                    ShellItem item = (ShellItem)dropListItem.Tag;
                    parentDropItem = item;

                    ShellHelper.GetIDropTarget(item, out dropTargetPtr, out dropTarget);
                    reset = true;
                }
            }
            else
            {
                if (dropListItem != null)
                {
                    if (dropTarget != null)
                    {
                        dropTarget.DragLeave();
                    }

                    ReleaseCom();

                    dropListItem.Selected = wasSelected;

                    dropListItem   = null;
                    parentDropItem = br.SelectedItem;

                    ShellHelper.GetIDropTarget(br.SelectedItem, out dropTargetPtr, out dropTarget);
                    reset = true;
                }
            }

            #endregion

            if (dropTarget != null)
            {
                if (reset)
                {
                    dropTarget.DragEnter(dropDataObject, grfKeyState, pt, ref pdwEffect);
                }
                else
                {
                    dropTarget.DragOver(grfKeyState, pt, ref pdwEffect);
                }
            }
            else
            {
                pdwEffect = DragDropEffects.None;
            }

            if (dropHelper != null)
            {
                dropHelper.DragOver(ref pt, pdwEffect);
            }

            return(ShellAPI.S_OK);
        }
コード例 #10
0
        public int DragOver(ShellAPI.MK grfKeyState, ShellAPI.POINT pt, ref DragDropEffects pdwEffect)
        {
            bool reset = false;

            #region Get DropItem

            Point point = br.FolderView.PointToClient(new Point(pt.x, pt.y));
            TreeViewHitTestInfo hitTest = br.FolderView.HitTest(point);
            if (!TreeNode.Equals(dropNode, hitTest.Node))
            {
                if (dropTarget != null)
                {
                    dropTarget.DragLeave();
                }

                ReleaseCom();

                dropNode = hitTest.Node;
                br.FolderView.SelectedNode = dropNode;

                if (dropNode == null)
                {
                    pdwEffect = DragDropEffects.None;

                    if (dropHelper != null)
                    {
                        dropHelper.DragOver(ref pt, pdwEffect);
                    }

                    return(ShellAPI.S_OK);
                }
                else
                {
                    ShellItem item = (ShellItem)dropNode.Tag;
                    parentDropItem = item;

                    ShellHelper.GetIDropTarget(item, out dropTargetPtr, out dropTarget);
                    reset = true;
                }
            }
            else if (dropNode == null)
            {
                if (dropTarget != null)
                {
                    dropTarget.DragLeave();
                }

                ReleaseCom();

                dropNode        = null;
                br.SelectedNode = null;

                pdwEffect = DragDropEffects.None;

                if (dropHelper != null)
                {
                    dropHelper.DragOver(ref pt, pdwEffect);
                }

                return(ShellAPI.S_OK);
            }

            #endregion

            if (dropTarget != null)
            {
                if (reset)
                {
                    dropTarget.DragEnter(dropDataObject, grfKeyState, pt, ref pdwEffect);
                }
                else
                {
                    dropTarget.DragOver(grfKeyState, pt, ref pdwEffect);
                }
            }
            else
            {
                pdwEffect = DragDropEffects.None;
            }

            if (dropHelper != null)
            {
                dropHelper.DragOver(ref pt, pdwEffect);
            }

            return(ShellAPI.S_OK);
        }
コード例 #11
0
        /// <summary>
        /// Notifies the DragDropHelper that the current Control received
        /// a DragOver event.
        /// </summary>
        /// <param name="dropHelper">The DragDropHelper instance to notify.</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 DragOver(this IDropTargetHelper dropHelper, Point cursorOffset, DragDropEffects effect)
        {
            Win32Point pt = cursorOffset.ToWin32Point();

            dropHelper.DragOver(ref pt, (int)effect);
        }
コード例 #12
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(Point cursorOffset, DragDropEffects effect)
 {
     s_instance.DragOver(cursorOffset, effect);
 }
コード例 #13
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);
        }