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. Image for the cookie policy date

Diagram Handlers

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

1 Reply

J. J.Nagarajan Syncfusion Team July 30, 2007 06:54 PM UTC

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()
{
InitializeComponent();
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);
}
else
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.

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

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);

[EventHandlerPriority(true)]
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.

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

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);
symbol1.CentralPort.TryConnect(line.HeadEndPoint);
symbol2.CentralPort.TryConnect(line.TailEndPoint);
this.diagram.Model.LineRouter.RouteConnector(line);
this.diagram.Model.EndUpdate();

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

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

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();
grfx.MultiplyTransform(matrixParentsTransorm);

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

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.

Thanks,
Nagaraj



Loader.
Live Chat Icon For mobile
Up arrow icon