I am trying to change and show the rectangle that is shown when a drag and drop is performed on a diagram. I have some custom data that I am dropping to the diagram and I want to show the bounds of the data in the rectangle. Is there a way to do this?
ADAdministrator Syncfusion Team December 16, 2004 10:12 PM UTC
To allow dragging and dropping an object other than a NodeCollection or a DragDropData object you will have to override the drop and drop methods in Diagram. Those methods are OnDragEnter, OnDragDrop, OnDragLeave, and OnDragOver. The reason is that the drag and drop code only looks for objects of type NodeCollection or DragDropData. Anything else such as a Bitmap or Metafile will be ignored. I discussed this issue with the Diagram team and they said a couple of changes\enhancements needed to made to make it easier to implment what you are seeking:
- Adding stock code that will recognize images such as bitmaps and metafiles and allow them to be tracked and dropped onto the diagram.
- And modularize the drag and drop methods in Diagram in such a way that it allows the user to add new types without having to override and re-implement those methods.
ADAdministrator Syncfusion Team December 21, 2004 05:16 PM UTC
Looks like your question was about changing the outline rectangle that Essential Diagram renders during a drag-drop operation.
The drag rectangle that you notice over the Diagram control is rendered through the Diagram.StartDragRect(int x, int y, int width, int height), Diagram.UpdateDragRect(int x, int y) and Diagram.EraseDragRect() methods present in the Syncfusion.Windows.Forms.Diagram.Controls.Diagram class that implements the Diagram control type. Unfortunately, these methods are all marked as private and in order to override the drawing you will have to first override the Diagram.OnDragEnter(System.Windows.Forms.DragEventArgs e), Diagram.OnDragOver(System.Windows.Forms.DragEventArgs e) and Diagram.OnDragLeave(System.EventArgs e) methods from which the above XXXDragRect(...) methods are invoked, copy/paste the base implementation and use your custom drawing methods in place of the Start/Update/EraseDragRect(...) drawing routines.
If you do not have the source code version of Essential Diagram and would like to take a look at the base implementation for help with your custom code, please send an email to ''firstname.lastname@example.org'' with a reference to this forum post.