1. Can I save the lines that I'll draw? Coz I was thinking of making a reference to the lines I created.
2. I have a picturebox that was connected to another picturebox using a line. (Just like a flowchart, but the lines are in "Z" shape). Is it possible that when I moved my picturebox in runtime, lines will follow? My pictureboxes are movable. If yes, please tell me how.
Here my code in Paint Event:
void PaintThis(object sender, PaintEventArgs e)
{
newStruct ST = new newStruct();
xd.Load(filename);
XmlNodeList xnl = xd.SelectSingleNode("root").ChildNodes;
foreach (XmlNode xn in xnl)
{
XmlElement xe = (XmlElement)xn;
XmlNodeList name = xe.GetElementsByTagName("picname");
XmlNodeList x1 = xe.GetElementsByTagName("x1");
XmlNodeList y1 = xe.GetElementsByTagName("y1");
XmlNodeList xc = xe.GetElementsByTagName("xcenter");
XmlNodeList yc = xe.GetElementsByTagName("ycenter");
XmlNodeList x2 = xe.GetElementsByTagName("x2");
XmlNodeList y2 = xe.GetElementsByTagName("y2");
ST.graps = e.Graphics;
Pen myPen = new Pen(System.Drawing.Color.Blue, 3);
for (int j = 0; j < name.Count; j++)
{
ST.x1St = Convert.ToInt32(x1[j].InnerText);
ST.y1St = Convert.ToInt32(y1[j].InnerText);
ST.xcSt = Convert.ToInt32(xcenter[j].InnerText);
ST.ycSt = Convert.ToInt32(ycenter[j].InnerText);
ST.x2St = Convert.ToInt32(x2[j].InnerText);
ST.y2St = Convert.ToInt32(y2[j].InnerText);
ST.halfHeight = 50;
ST.halfWidth = 50;
ST.graps.DrawLine(myPen, ST.x1St + ST.halfWidth, ST.y1St + ST.halfHeight, ST.xcSt, ST.ycSt + ST.halfHeight);
ST.graps.DrawLine(myPen, ST.xcSt, ST.ycSt + ST.halfHeight, ST.xcSt, ST.x2St);
ST.graps.DrawLine(myPen, ST.xcSt, ST.x2St, ST.x2St, ST.y2St);
}
}
}
Thanks.:confused: