Beispiel #1
0
        public static void DrawNode(GViewer gLocalViewer, GraphItem item, bool selected, bool maxRelations)
        {
            if (gLocalViewer.InvokeRequired)
            {
                gLocalViewer.Invoke(new MethodInvoker(delegate() { DrawNode(gLocalViewer, item, selected, maxRelations); }));
                return;
            }

            Microsoft.Msagl.Drawing.Graph graph = gLocalViewer.Graph;
            Node node = new Node(item.UniqueID);

            if (item.Name.Length > 12)
            {
                node.Label.Text = string.Format("{0}...", item.Name.Substring(0, 6));
            }
            else
            {
                node.Label.Text = item.Name;
            }
            node.UserData = item;

            if (selected || maxRelations)
            {
                if (selected && maxRelations)
                {
                    node.DrawNodeDelegate = new DelegateToOverrideNodeRendering(CustomDrawMultiRelaitionsSelectedNode);
                }
                else
                {
                    if (selected)
                    {
                        node.DrawNodeDelegate = new DelegateToOverrideNodeRendering(CustomDrawNormalSelectedNode);
                    }
                    else
                    {
                        if (maxRelations)
                        {
                            node.DrawNodeDelegate = new DelegateToOverrideNodeRendering(CustomDrawMultiRelaitionsNode);
                        }
                        else
                        {
                            node.DrawNodeDelegate = new DelegateToOverrideNodeRendering(CustomDrawNormalNode);
                        }
                    }
                }
            }
            else
            {
                node.DrawNodeDelegate = new DelegateToOverrideNodeRendering(CustomDrawNormalNode);
            }
            graph.AddNode(node);
            gLocalViewer.Graph = graph;
        }
Beispiel #2
0
 /// <summary>
 ///
 /// </summary>
 public void NoParamsDelegateThread()
 {
     _gviewer.Invoke(new MethodInvoker(NoParamsDelegateNoThread));
 }