Hello,
I tried to remove the label from a GoGeneralNodePort by using
GoGeneralNodePort.Label = null;
However, this creates an exception… To be sure everything was initialized correctly in my object, I modified the demo1 project :
in function AutoLinkingPort.AddSourceLink (AutolinkNode.cs, line 130) :
<div style="margin-left: 40px;"> public override void AddSourceLink(IGoLink link) {
AutoLinkNode node = this.Parent as AutoLinkNode;
if (node != null) {
GoGeneralNodePort p = node.MakePort(true);
node.AddLeftPort(p);
link.ToPort = p;
<span style="color: rgb(255, 0, 0);">p.Label = null; // Added line</span>
}
}
In that case, I still got an exception:
Message “Object reference not set to an instance of an object.” string
StackTrace " at Northwoods.Go.GoGeneralNodePort.set_Label(GoGeneralNodePortL abel value)\r\n at Demo1.AutoLinkingPort.AddSourceLink(IGoLink link) in C:\Program Files\Northwoods Software\GoDiagram Win 2.5.1 for .NET 2.0\Samples\Demo1\AutoLinkNode.cs:line 130\r\n at Northwoods.Go.GoLink.set_ToPort(IGoPort value)\r\n at Northwoods.Go.GoLabeledLink.set_ToPort(IGoPort value)\r\n at Northwoods.Go.GoView.CreateLink(IGoPort fromPort, IGoPort toPort)\r\n at Northwoods.Go.GoToolLinking.DoNewLink(IGoPort fromPort, IGoPort toPort)\r\n at Northwoods.Go.GoToolLinking.DoMouseUp()\r\n at Northwoods.Go.GoView.DoMouseUp()\r\n at Northwoods.Go.GoView.OnMouseUp(MouseEventArgs evt)\r\n at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)\r\n at System.Windows.Forms.Control.WndProc(Message& m)\r\n at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(M essage& m)\r\n at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Mes sage& m)\r\n at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)\r\n at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MS G& msg)\r\n at System.Windows.Forms.Application.ComponentManager.System.Win dows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMes sageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)\r\n at System.Windows.Forms.Application.ThreadContext.RunMessageLoo pInner(Int32 reason, ApplicationContext context)\r\n at System.Windows.Forms.Application.ThreadContext.RunMessageLoo p(Int32 reason, ApplicationContext context)\r\n at System.Windows.Forms.Application.Run(Form mainForm)\r\n at Demo1.MainForm.Main(String[] args) in C:\Program Files\Northwoods Software\GoDiagram Win 2.5.1 for .NET 2.0\Samples\Demo1\MainForm.cs:line 1580\r\n at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)\r\n at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)\r\n at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssem bly()\r\n at System.Threading.ThreadHelper.ThreadStart_Context(Object state)\r\n at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)\r\n at System.Threading.ThreadHelper.ThreadStart()" &nbs p; string
What should I do ?