We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How disable copy shapes

Thread ID:





72146 Mar 5,2008 11:50 AM UTC Jan 19,2009 06:30 AM UTC WinForms 5
Tags: Diagram
Radmir Tagirov
Asked On March 5, 2008 11:50 AM UTC

How to disable shape copying (by holding Ctrl key and mouse button up)?
I tried to override method Clone(), but spotted an stange issue: with every mouse click this shape becamed more transparent.

Administrator [Syncfusion]
Replied On March 5, 2008 08:55 PM UTC

Hi Radmir,

If your intention is to prevent the Copy paste functionality while pressing control key and drag the node then you need to prevent the movement of nodes when pressing control key. You need to handle KeyDown and KeyUp event of the diagram control.

The attached sample demonstrates this behavior completely.


Please refer to it and let us know if you have any questions.

Please let me know if you have any questions.


Radmir Tagirov
Replied On April 18, 2008 05:57 AM UTC

I have a new problem. If I press Ctrl key, and then I try move a shape, all works correctly. But, if I start move a shape before I shall press Ctrl key this code doesn't work correctly.

Administrator [Syncfusion]
Replied On June 2, 2008 11:14 AM UTC

Hi ,

Sorry for the delay in getting back to you.

Please refer to the modified sample. In this sample when you drag the node, the node can be moved and when you press control key while dragging the node, it will stop the moving and prevent the copy-paste action.

Sample: http://www.syncfusion.com/Product/uploads/Copy_PasteNodes_b2e1d64f.zip

Video: http://www.syncfusion.com/Product/uploads/Video_72146_121757f5.zip

Please let me know if you this helps.


Stephen Allen
Replied On January 17, 2009 10:18 PM UTC

Neither of these solutions work very well, they require you to override the KeyDown and KeyUp events and don't work well when the user presses Ctrl after he starts dragging.

The best fix would be for Syncfustion to add an option on the Diagram that enables or disables this Ctrl+Drag copy feature.

As a work-around that is better than the ones proposed above, try the following:

public class YourClass
private Diagram _diagram;

public YourClass()
this._diagram = new Diagram();

// Substitute our own SelectTool that modifies the MoveTool so that
// we never make copies of nodes when Ctrl+Dragging
Tool selectTool = (Tool)_diagram.Controller.GetTool("SelectTool");
CustomSelectTool customSelectTool = new CustomSelectTool(_diagram.Controller);
if (_diagram.Controller.ActiveTool is SelectTool)

public class CustomSelectTool : SelectTool
public CustomSelectTool(DiagramController controller)
: base(controller)

public CustomSelectTool(DiagramController controller, SelectMode selectMode)
: base(controller, selectMode)

protected override Tool PerformMove(MouseEventArgs evtArgs)
MoveTool moveTool = (MoveTool) base.PerformMove(evtArgs);
moveTool.DragCopyOffset = float.MaxValue;
return moveTool;


Ajeet M [Syncfusion]
Replied On January 19, 2009 06:30 AM UTC

Hi Stephen,

Thanks for your valuable suggestion and workaround for the ctrl+drag copy prevention.

We are already looking into appending a property flag for the use of ctrl+drag to allow copy of shapes as per user demand. We shall keep you updated on this always.

Let me know if you shall need any further clarifications in this regard.

Happy coding!



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon