ineale 0 Newbie Poster

I have a program that will use the following code to draw the nodes i need (ellipses), but it won't draw the paths(lines). The only thing i could think of is that it might not be calling properly through two classes.

protected override void  OnRender(DrawingContext drawingContext)
        {
            base.OnRender(drawingContext);
            DrawingGroup dGroup = new DrawingGroup();
            using (DrawingContext dc = dGroup.Open())
            {
                foreach (PathNode path_node in m_AllNodes)
                {
                    path_node.DrawLinks(dc);
                } 
                foreach (PathNode path_node in m_AllNodes)
                {
                    path_node.DrawNode(dc);
                }  
            }
            
            DrawingImage dImageSource = new DrawingImage(dGroup);
            theImage.Source = dImageSource;

the next two blocks are the functions to draw the node and the link that are found in the PathNode class:

public void DrawNode(DrawingContext dc)
        {
               dc.DrawEllipse(EllipseBrush, EllipsePen, point, NODE_RADIUS, NODE_RADIUS);
  
        }
public void DrawLinks(DrawingContext dc)
        {
            foreach (PathLink path_link in Links)
            {
                path_link.DrawLink(dc);
            }
        }

and then the function to draw the link in class PathLink

public void DrawLink(DrawingContext dc)
        {
           
            dc.DrawLine(LinkPen, lsp, lep);

        }

the two pens are properly defined, but I just realized that the ellipse pen isn't showing up either, only the brush, so it isn't drawing the pens. Any idea why it wouldn't draw the pen?

i have tested it defining a new pen within the DrawLine call as well.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.