Beispiel #1
0
        private void treeView_GiveFeedback(object sender, GiveFeedbackEventArgs e)
        {
            // 드래그 드랍을 받는 타겟에서 드랍 가능 여부를 e.Effect로 알수 있다.

            Debug.WriteLine("\t Source Give Feedback : " + e.Effect);

            // 드랍 가능 여부 상태에 따라서 마우스 커서의 모양을 바꿔줄 수 있다.

            Cursor MyNormalCursor = null;
            Cursor MyNoDropCursor = null;
            try
            {

                MyNormalCursor = new Cursor("AllowDrop.cur");
                MyNoDropCursor = new Cursor("NoDrop.cur");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

            // Sets the custom cursor based upon the effect.
            e.UseDefaultCursors = false;
            if ((e.Effect & DragDropEffects.All) == DragDropEffects.All)
                Cursor.Current = MyNormalCursor;
            else
                Cursor.Current = MyNoDropCursor;
        }
 private void componentsListView_GiveFeedback(object sender, GiveFeedbackEventArgs e)
 {
     if (null != draggedImg)
     {
         e.UseDefaultCursors = false;
         Cursor.Current = new Cursor(new Bitmap(draggedImg, 32, 32).GetHicon());
     }
 }
Beispiel #3
0
 private void ActionHolder_GiveFeedback(object sender, GiveFeedbackEventArgs e)
 {
     if (dragging)
     {
         this.Location = new Point(this.Location.X, dragStartY + Cursor.Position.Y - dragStartMouseY);
         Refresh();
     }
 }
Beispiel #4
0
 public int OleGiveFeedback(int dwEffect) {
     GiveFeedbackEventArgs gfbevent = new GiveFeedbackEventArgs((DragDropEffects) dwEffect, true);
     peer.OnGiveFeedback(gfbevent);
     if (gfbevent.UseDefaultCursors) {
         return DragDropSUseDefaultCursors;
     }
     return 0;
 }
 private void checkedVersesCheckedListBox_GiveFeedback(object sender, GiveFeedbackEventArgs e)
 {
     if (e.Effect == DragDropEffects.Move)
     {
         Cursor.Current = Cursors.Hand;
     }
     else
     {
         Cursor.Current = Cursors.Default;
     }
 }
Beispiel #6
0
 private void ListDragSource_GiveFeedback(object sender, GiveFeedbackEventArgs e)
 {
     // Use custom cursors if the check box is checked.
     if (UseCustomCursorsCheck.Checked)
     {
         // Sets the custom cursor based upon the effect.
         e.UseDefaultCursors = false;
         if ((e.Effect & DragDropEffects.Move) == DragDropEffects.Move)
             Cursor.Current = MyNormalCursor;
         else
             Cursor.Current = MyNoDropCursor;
     }
 }
        protected override bool OnGiveFeedback(GiveFeedbackEventArgs gfbevent)
        {
            base.OnGiveFeedback(gfbevent);

            if (this.draggedDesignerImages != null)
            {
                gfbevent.UseDefaultCursors = false;
                if ((gfbevent.Effect & DragDropEffects.Move) == DragDropEffects.Move)
                    Cursor.Current = FreeFormDragDropManager.DragMoveCursor;
                else if ((gfbevent.Effect & DragDropEffects.Copy) == DragDropEffects.Copy)
                    Cursor.Current = FreeFormDragDropManager.DragCopyCursor;
                else
                    Cursor.Current = Cursors.No;

                return true;
            }

            return false;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="args"></param>
        protected override void OnGiveFeedback(GiveFeedbackEventArgs args)
        {
            base.OnGiveFeedback(args);

            if (this.DropSink != null)
                this.DropSink.GiveFeedback(args);
        }
		private void GridControl_GiveFeedback(object sender, GiveFeedbackEventArgs e)
		{
			if (_downHitInfo == null) return;
			e.UseDefaultCursors = false;
			Cursor.Current = _dragRowCursor;
		}
Beispiel #10
0
 /// <summary>
 /// Change the cursor to reflect the current drag operation.
 /// </summary>
 /// <remarks>You only need to override this if you want non-standard cursors.
 /// The standard cursors are supplied automatically.</remarks>
 /// <param name="args"></param>
 public virtual void GiveFeedback(GiveFeedbackEventArgs args)
 {
     args.UseDefaultCursors = true;
 }
 public void OnGiveFeedback(GiveFeedbackEventArgs e)
 {
 }
Beispiel #12
0
 public void GiveFeedback(GiveFeedbackEventArgs e) {
   e.UseDefaultCursors = false;
   Cursor.Current = feedbackCursor;
 }
	protected override void OnGiveFeedback(GiveFeedbackEventArgs gfevent)
			{
				// TODO
			}
 public void Content_GiveFeedback(System.Windows.Forms.GiveFeedbackEventArgs e)
 {
 }
 public virtual void Content_GiveFeedback(System.Windows.Forms.GiveFeedbackEventArgs e)
 {
     Content_GiveFeedback(e, null);
 }
Beispiel #16
0
 //关于拖拽的一些事件处理
 private void TestControl_GiveFeedback(object sender, System.Windows.Forms.GiveFeedbackEventArgs e)
 {
     System.Diagnostics.Debug.WriteLine("GiveFeedback");
 }
Beispiel #17
0
 private void HandleGiveFeedback(object sender, GiveFeedbackEventArgs e)
 {
     OnGiveFeedback(e);
 }
Beispiel #18
0
 public override void OnGiveFeedback(Glyph g, System.Windows.Forms.GiveFeedbackEventArgs e)
 {
     base.OnGiveFeedback(g, e);
 }
Beispiel #19
0
		//-------------------------------------------------------------------------------------
		/// <summary>
		/// 
		/// </summary>
		/// <param name="e"></param>
		protected override void OnGiveFeedback(GiveFeedbackEventArgs e)
		{
			if(allowInternalDragDrop)
			{
				Rectangle r = treeView.RectangleToScreen(treeView.ClientRectangle); 
				if(r.Contains(Control.MousePosition))
				{
					e.UseDefaultCursors = false;
					r = new Rectangle(20,20,r.Width - 40, r.Height - 40);
					Point p = treeView.PointToClient(Control.MousePosition);
					if(p.Y < r.Y)
						WinAPI.APIWrappers.SendMessage(treeView.Handle, WinAPI.WM.VSCROLL, 0, 0);
					if(p.Y > r.Height)
						WinAPI.APIWrappers.SendMessage(treeView.Handle, WinAPI.WM.VSCROLL, 1, 0);
					if(p.X < r.X)
						WinAPI.APIWrappers.SendMessage(treeView.Handle, WinAPI.WM.HSCROLL, 0, 0);
					if(p.X > r.Width)
						WinAPI.APIWrappers.SendMessage(treeView.Handle, WinAPI.WM.HSCROLL, 1, 0);
				}
			}
			else
				base.OnGiveFeedback(e);
		}
Beispiel #20
0
 private void Squar_GiveFeedback(object sender, System.Windows.Forms.GiveFeedbackEventArgs e)
 {
     e.UseDefaultCursors = false;
     Cursor.Current      = Cursors.Hand;
 }
Beispiel #21
0
 protected virtual void OnGiveFeedback(GiveFeedbackEventArgs giveFeedbackEvent)
 {
     throw null;
 }
		private void ShellTreeView_GiveFeedback(object sender, GiveFeedbackEventArgs e) {
			e.UseDefaultCursors = true;
			var doo = new System.Windows.Forms.DataObject(this._DataObject);
			if (doo.GetDataPresent("DragWindow")) {
				IntPtr hwnd = ShellView.GetIntPtrFromData(doo.GetData("DragWindow"));
				User32.PostMessage(hwnd, 0x403, IntPtr.Zero, IntPtr.Zero);
			} else {
				e.UseDefaultCursors = true;
			}

			if (ShellView.IsDropDescriptionValid(this._DataObject)) {
				e.UseDefaultCursors = false;
				Cursor.Current = Cursors.Arrow;
			} else {
				e.UseDefaultCursors = true;
			}

			if (ShellView.IsShowingLayered(doo)) {
				e.UseDefaultCursors = false;
				Cursor.Current = Cursors.Arrow;
			} else {
				e.UseDefaultCursors = true;
			}

			base.OnGiveFeedback(e);
		}
Beispiel #23
0
        private void treeView1_GiveFeedback(object sender, GiveFeedbackEventArgs e)
        {
            if (e.Effect == DragDropEffects.Move)
            {
                // Show pointer cursor while dragging

                e.UseDefaultCursors = false;
                this.treeView1.Cursor = Cursors.Default;
            }
            else e.UseDefaultCursors = true;
        }
 bool IWorkflowDesignerMessageSink.OnGiveFeedback(GiveFeedbackEventArgs e)
 {
     try
     {
         OnGiveFeedback(e);
     }
     catch
     {
     }
     return true;
 }
Beispiel #25
0
			void IBranch.OnGiveFeedback(GiveFeedbackEventArgs args, int row, int column)
			{
			}
 private void OnGiveFeedback(object sender, GiveFeedbackEventArgs e)
 {
     if (m_dragData != null)
     {
         DropDescriptionHelper.DefaultGiveFeedback(m_dragData, e);
     }
 }
Beispiel #27
0
		private void GiveFeedback (IntPtr action)
		{
			GiveFeedbackEventArgs gfe = new GiveFeedbackEventArgs (EffectFromAction (drag_data.Action), true);

			Control c = MwfWindow (source);
			c.DndFeedback (gfe);

			if (gfe.UseDefaultCursors) {
				Cursor cursor = CursorNo;
				if (drag_data.WillAccept) {
					// Same order as on MS
					if (action == XdndActionCopy)
						cursor = CursorCopy;
					else if (action == XdndActionLink)
						cursor = CursorLink;
					else if (action == XdndActionMove)
						cursor = CursorMove;
				}
				// TODO: Try not to set the cursor so much
				//if (cursor.Handle != CurrentCursorHandle) {
				XplatUIX11.XChangeActivePointerGrab (display,
						EventMask.ButtonMotionMask |
						EventMask.PointerMotionMask |
						EventMask.ButtonPressMask |
						EventMask.ButtonReleaseMask,
						cursor.Handle, IntPtr.Zero);
				//CurrentCursorHandle = cursor.Handle;
				//}
			}
		}
Beispiel #28
0
        protected override void OnGiveFeedback(GiveFeedbackEventArgs gfbevent)
        {
            try
            {
                base.OnGiveFeedback(gfbevent);
                if (gfbevent.Effect != DragDropEffects.None)
                {
                    gfbevent.UseDefaultCursors = false;

                    if (_tempCursor == null || Cursor.Current.Handle != _tempCursor.Handle)
                    {
                        if (_tempCursor != null)
                        {
                            _tempCursor.Dispose();
                        }

                        //
                        using (Bitmap tempBitmap = new Bitmap(this.Image.Width + 20, this.Image.Height + 32))
                            using (Graphics g = Graphics.FromImage(tempBitmap))
                                using (StringFormat textformat = new StringFormat())
                                    using (SolidBrush fontBrush = new SolidBrush(Color.White))
                                    {
                                        g.SmoothingMode = SmoothingMode.HighQuality;

                                        g.FillRoundedRectangle(
                                            Brushes.LightSlateGray,
                                            0,
                                            tempBitmap.Height - 20,
                                            tempBitmap.Width - 4,
                                            16,
                                            8,
                                            RectangleEdgeFilter.All);

                                        // 头像
                                        Rectangle imageRect = new Rectangle(
                                            (tempBitmap.Width - this.Image.Width) / 2,
                                            8,
                                            this.Image.Width,
                                            this.Image.Height);
                                        g.FillRectangle(Brushes.White, imageRect);
                                        g.DrawRectangle(Pens.LightBlue, imageRect);
                                        imageRect.Inflate(-4, -4);
                                        g.DrawImageTransparent(this.Image, imageRect);

                                        textformat.Alignment = StringAlignment.Center;
                                        RectangleF textRect = new RectangleF(
                                            0,
                                            this.Image.Height + this.Padding.Bottom + 12,
                                            tempBitmap.Width,
                                            tempBitmap.Height);
                                        g.DrawString(this.Caption, this.Font, fontBrush, textRect, textformat);

                                        _tempCursor    = new Cursor(tempBitmap.GetHicon());
                                        Cursor.Current = _tempCursor;
                                    }
                    }
                }
                //{
                //Effect = gfbevent.Effect;
                //}
            }
            catch (Exception)
            {
                this.OnGiveFeedback(gfbevent);
            }
        }
 /// <summary>
 /// Updates the visual cues for feedback given to the user when performing drag drop operation.
 /// </summary>
 /// <param name="e">A GiveFeedbackEventArgs that contains the event data.</param>
 protected virtual void OnGiveFeedback(GiveFeedbackEventArgs e)
 {
     if (e == null)
         throw new ArgumentNullException("e");
 }
 void IBranch.OnGiveFeedback(System.Windows.Forms.GiveFeedbackEventArgs args, int row, int column)
 {
 }
		protected virtual void OnGiveFeedback (GiveFeedbackEventArgs giveFeedbackEvent)
		{
			GiveFeedbackEventHandler eh = (GiveFeedbackEventHandler)(Events[GiveFeedbackEvent]);
			if (eh != null)
				eh (this, giveFeedbackEvent);
		}
Beispiel #32
0
 private void treeList1_GiveFeedback(object sender, System.Windows.Forms.GiveFeedbackEventArgs e)
 {
     e.UseDefaultCursors = false;
 }
Beispiel #33
0
 private void listBox1_GiveFeedback(object sender, GiveFeedbackEventArgs e)
 {
     if (timetableControl1.ShowDragGhost && DragCursor_ != null)
     {
         e.UseDefaultCursors = false;
         Cursor.Current = DragCursor_;
     }
 }
 protected override void OnGiveFeedback(GiveFeedbackEventArgs gfbevent)
 {
     base.OnGiveFeedback(gfbevent);
     myUpToDate = false;
     this.Invalidate();
 }
 protected override void OnGiveFeedback(GiveFeedbackEventArgs e)
 {
     MultiPanePageDesigner selectedPageDesigner = this.GetSelectedPageDesigner();
     if (selectedPageDesigner != null)
     {
         selectedPageDesigner.InternalOnGiveFeedback(e);
     }
 }
 private void ListView_GiveFeedback(object sender,
     GiveFeedbackEventArgs e)
 {
     e.UseDefaultCursors = false;
     if (e.Effect == DragDropEffects.Copy)
     {
         Bitmap selected = (Bitmap) imageList.Images[listView.SelectedItems[0].ImageKey];
         if (selected != null)
             Cursor.Current = new Cursor(selected.GetHicon());
     }
 }
Beispiel #37
0
 private void listView1_GiveFeedback(object sender, GiveFeedbackEventArgs e)
 {
     if (e.Effect == DragDropEffects.Move)
     {
         e.UseDefaultCursors = false;
         listView1.Cursor = dragcursor;
         pictureBox1.Cursor = Cursors.Default;
     }
     else
     {
         e.UseDefaultCursors = true;
         listView1.Cursor = Cursors.Default;
         pictureBox1.Cursor = Cursors.Default;
     }
 }
Beispiel #38
0
 private void lvFileList_GiveFeedback(object sender, GiveFeedbackEventArgs e)
 {
     try
     {
         if (m_isDragDropInsideControls && e.Effect == DragDropEffects.Copy)
         {
             Cursor.Current = MoveDrop;
             e.UseDefaultCursors = false;
         }
         else
             e.UseDefaultCursors = true;
     }
     catch (Exception ex)
     {
         Logging.LogException(ex);
         e.UseDefaultCursors = true;
     }
 }
		public virtual void OnGiveFeedback(CellContext sender, GiveFeedbackEventArgs e)
		{
			if (GiveFeedback!=null)
				GiveFeedback(sender, e);
		}
 protected override void OnGiveFeedback(GiveFeedbackEventArgs gfbevent)
 {
     base.OnGiveFeedback(gfbevent);
     using (WorkflowMessageDispatchData data = new WorkflowMessageDispatchData(this, gfbevent))
     {
         foreach (WorkflowDesignerMessageFilter filter in data.Filters)
         {
             if (((IWorkflowDesignerMessageSink) filter).OnGiveFeedback(gfbevent))
             {
                 return;
             }
         }
     }
 }
Beispiel #41
0
 protected override bool OnGiveFeedback(GiveFeedbackEventArgs gfbevent)
 {
     return true;
 }
Beispiel #42
0
        /// <summary>
        /// Provides a default GiveFeedback event handler for drag sources.
        /// </summary>
        /// <param name="data">The associated data object for the event.</param>
        /// <param name="e">The event arguments.</param>
        public static void DefaultGiveFeedback(IDataObject data, GiveFeedbackEventArgs e)
        {
            // For drop targets that don't set the drop description, we'll
            // set a default one. Drop targets that do set drop descriptions
            // should set an invalid drop description during DragLeave.
            bool          setDefaultDropDesc = false;
            bool          isDefaultDropDesc  = IsDropDescriptionDefault(data);
            DropImageType currentType        = DropImageType.Invalid;

            if (!IsDropDescriptionValid(data) || isDefaultDropDesc)
            {
                currentType        = GetDropImageType(data);
                setDefaultDropDesc = true;
            }

            if (IsShowingLayered(data))
            {
                // The default drag source implementation uses drop descriptions,
                // so we won't use default cursors.
                e.UseDefaultCursors = false;
                Cursor.Current      = Cursors.Arrow;
            }
            else
            {
                e.UseDefaultCursors = true;
            }

            // We need to invalidate the drag image to refresh the drop description.
            // This is tricky to implement correctly, but we try to mimic the Windows
            // Explorer behavior. We internally use a flag to tell us to invalidate
            // the drag image, so if that is set, we'll invalidate. Otherwise, we
            // always invalidate if the drop description was set by the drop target,
            // *or* if the current drop image is not None. So if we set a default
            // drop description to anything but None, we'll always invalidate.
            if (InvalidateRequired(data) || !isDefaultDropDesc || currentType != DropImageType.None)
            {
                InvalidateDragImage(data);

                // The invalidate required flag only lasts for one invalidation
                SetInvalidateRequired(data, false);
            }

            // If the drop description is currently invalid, or if it is a default
            // drop description already, we should check about re-setting it.
            if (setDefaultDropDesc)
            {
                // Only change if the effect changed
                if ((DropImageType)e.Effect != currentType)
                {
                    if (e.Effect == DragDropEffects.Copy)
                    {
                        data.SetDropDescription(DropImageType.Copy, "Copy", "");
                    }
                    else if (e.Effect == DragDropEffects.Link)
                    {
                        data.SetDropDescription(DropImageType.Link, "Link", "");
                    }
                    else if (e.Effect == DragDropEffects.Move)
                    {
                        data.SetDropDescription(DropImageType.Move, "Move", "");
                    }
                    else if (e.Effect == DragDropEffects.None)
                    {
                        data.SetDropDescription(DropImageType.None, null, null);
                    }
                    SetDropDescriptionIsDefault(data, true);

                    // We can't invalidate now, because the drag image manager won't
                    // pick it up... so we set this flag to invalidate on the next
                    // GiveFeedback event.
                    SetInvalidateRequired(data, true);
                }
            }
        }