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.
Unfortunately, activation email could not send to your email. Please try again.

Diagram Handlers

Thread ID:





66125 Jul 28,2007 12:10 PM Jul 30,2007 02:54 PM Windows Forms 1
Tags: Diagram
R. Krishna Prasadh
Asked On July 28, 2007 12:10 PM

We are much convinced about Essential Studio, but am not sure when we would be purchased. I have few points for clarification.

1. Can you extend the 25% waiver till August 15.

2. How do I handle the Mouse Hover Events in a diagram to asses the underlying Node. This is basically to show a tooltip about the properties of the control, when I hover the mouse on a Node.

3. How do control deletion of a node. For example, I select a node and hit "Delete" key from the keyboard. I want to handle this event, before the Node vanishes.

4. How do I restrict OrthogonalConnector overlapping. No line should overlap other at any instance. (This point is of high priority). There was a sample given by you for this. That fails at many instances.

5. How do I modify the bounding rectangle when a node gets selected. I do not want the rectangle to be visible. I want only the end point connectors to be visible, and as well I should be able to change the color of the endpoint connectors. How do I acheive this.

I would request you to reply for this with utmost priority, as I have a demo to presented by Tuesday.

Thanks & Regards,
R. Krishna Prasadh

J.Nagarajan [Syncfusion]
Replied On July 30, 2007 02:54 PM

Hi Krishna,

1. Please conduct our sales team "salessupport@syncfusion.com" to request 25% waiver query.

2. If you want to show the tool tip when the user hover the mouse on the node then you can write a delegate to fire this event. Please refer to the following code snippet.

public delegate void NodeHover(object sender, MouseEventArgs args);
public event NodeHover nodehover;
public MainForm()
this.nodehover += new NodeHover(MainForm_nodehover);
ToolTip tooltip = new ToolTip();
void MainForm_nodehover(object sender, MouseEventArgs args)

tooltip.Active = true;
tooltip.SetToolTip(this.diagram1, symbol2.Name);
private void diagram1_MouseMove(object sender, MouseEventArgs e)
RectangleF rect = new RectangleF(this.diagram1.Controller.MouseLocation.X, this.diagram1.Controller.MouseLocation.Y,1,1);
if (symbol2.BoundingRectangle.IntersectsWith(rect))
this.nodehover(sender, e);
tooltip.Active = false;

I have attached the sample that demonstrates this completely. In this sample when you hover the mouse the tooltip will display with the node's name. You can download the sample from the following page.


Please let me know if you ahve any questions.

3. When you press delete key to remove the node , the NodeCollectionChanging event gets fired. You can handle some actions before the node deletion. Please refer to the following code snippet.

this.diagram1.Model.EventSink.NodeCollectionChanging += new CollectionExEventHandler(EventSink_NodeCollectionChanging);

void EventSink_NodeCollectionChanging(CollectionExEventArgs evtArgs)
if (evtArgs.ChangeType == CollectionExChangeType.Remove)
MessageBox.Show("Delete Nodes");

I have attached the sample for your reference. You can download the sample form the following page.


Please refer to the sample and let me know if you ahve any questions.

4. If you want to automatically change the line routing of the Orthogonal Connector and prevent the overlapping of the line , then you have to set Model.LineRoutingEnabled property to true. Please refer to the following code snippet.

this.diagram.Model.LineRoutingEnabled = true;
OrthogonalConnector line = new OrthogonalConnector(symbol1.PinPoint, symbol2.PinPoint);
symbols.Add( line );
this.diagram.Model.AppendChildren(symbols, out position);

I have attached the sample that demonstrates this completely. You can download this sample from the following page.


5. If you want to hide the selection rectangle of a node then you have to derive the diagram View and override DrawHandles() method. Please refer to the following code snippet

public class MyView:Syncfusion.Windows.Forms.Diagram.View
public MyView()

protected override void DrawHandles(System.Drawing.Graphics grfx, NodeCollection nodesSelected)
if (nodesSelected != null && nodesSelected.Count > 0)
foreach (Node nodeCur in nodesSelected)
if (nodeCur.Visible)
HandleEditMode resultHandleEditMode = nodeCur.EditStyle.DefaultHandleEditMode;
Matrix matrixParentsTransorm = GetParentsTransform(nodeCur);
GraphicsState stateSave = grfx.Save();

switch (resultHandleEditMode)
case HandleEditMode.Resize:
if (nodeCur is IEndPointContainer)
HandleRenderer.DrawEndPoints(grfx, nodeCur);
HandleRenderer.OutlineBoundingRectangle(grfx, nodeCur);
HandleRenderer.OutlineBoundingRectangle(grfx, nodeCur);

I have attached the sample that demonstrates this completely. You can download the sample from the following page

http://websamples.syncfusion.com/samples/Diagram.Windows/Prevent SelectionRectangle/main.htm

Please refer to the sample and let me know if you have any questions.



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.

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.