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
close icon

Connector''s decorator

Hi everybody.
Does anyone know how to change default(a simple line between two ports) connector decorator's after activating LineTool?
How can I get a list of End Point Decorators?
Thanks.
Best regards, Frank.

4 Replies

GM Gowri Manohari D Syncfusion Team May 23, 2009 05:57 AM UTC


Hi Frank,

Thanks for choosing Syncfusion Products.

The below is the code snippet for your first requirement.Code illustrates changing Decorators for LineConnectors.

diagram1.ActivateTool("LineTool");
LineTool line = (LineTool)diagram1.Controller.ActiveTool;
line.HeadDecorator.DecoratorShape = DecoratorShape.Filled45Arrow;

Please provide the some more details about your second question.



Thanks & Regards,
Gowri


VC Veaceslav Cosulet May 25, 2009 08:35 AM UTC

Thanks Gowri.
As for the second question, under below link below one can see all types of decorators in a window
http://syncfusion.com/products/windows-forms/diagram/end-point-decorator

Is it possible to get them all, I mean types of decorators, in such a window or I have to customize it myself in order to get them in such a window, or a ComboBox ???
Thanks.
Best regards, Frank.


VC Veaceslav Cosulet May 25, 2009 10:40 AM UTC

Hi again Gowri.
I wrote the bellow code in order to change line end decorator,

diagram1.ActivateTool("LineConnectorTool");
LineConnectorTool lineConnector = (LineConnectorTool)diagram1.Controller.ActiveTool;
lineConnector.HeadDecorator.DecoratorShape = DecoratorShape.Filled45Arrow;

but gained the following error:

System.InvalidCastException was unhandled
Message="Unable to cast object of type 'Syncfusion.Windows.Forms.Diagram.SelectTool' to type 'Syncfusion.Windows.Forms.Diagram.LineConnectorTool'."
Source="TrySyncfusionComponents"
StackTrace:
at TrySyncfusionComponents.Form1.button1_Click(Object sender, EventArgs e) in C:\Documents and Settings\cosulet\My Documents\Visual Studio 2008\Projects\TrySyncfusionComponents\TrySyncfusionComponents\Form1.cs:line 28
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at TrySyncfusionComponents.Program.Main() in C:\Documents and Settings\cosulet\My Documents\Visual Studio 2008\Projects\TrySyncfusionComponents\TrySyncfusionComponents\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:


In order to solve it I wrote

diagram1.ActivateTool("LineLinkTool");
LineConnectorTool lineConnector = (LineConnectorTool)diagram1.Controller.ActiveTool;
lineConnector.HeadDecorator.DecoratorShape = DecoratorShape.Filled45Arrow;

But in a warning it was said that LIneLinkTool is obsolete. One should use LineConnectorTool instead.

Does diagram1.ActivateTool("LineLinkTool"); activate LineLinkTool, or LineConnectorToll instead???
Thnaks and regards, Frank.


GM Gowri Manohari D Syncfusion Team May 26, 2009 09:08 AM UTC

Hi Frank,

Thanks for choosing Syncfusion Products.

I could reproduce your error.While activating LineConnectorTool,system throws an error.Because no tool is available with the name LineConnectorTool,thats why it shows default SelectTool.

LineConnectorTool is referred with the name as LineLinkTool.Instead of using LineConnectorTool,you can use LineLinkTool.Refer the sample code below.


diagram1.Controller.ActivateTool("LineLinkTool");
LineConnectorTool con = (LineConnectorTool)diagram1.Controller.ActiveTool;
con.HeadDecorator.DecoratorShape = DecoratorShape.Filled45Arrow;


Thanks & Regards,
Gowri

Loader.
Live Chat Icon For mobile
Up arrow icon