做搬家参考? [英] making references to move?

查看:39
本文介绍了做搬家参考?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

1.我可以保存要绘制的线条吗?因为我想参考我创建的线条.

2.我有一个图片框,该图片框通过一条线连接到另一个图片框. (就像流程图一样,但线条为"Z"形).当我在运行时移动图片框时,是否可能会跟随行?我的画框是可移动的.如果是,请告诉我怎么做.


这是我在Paint Event中的代码:

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;


             //DRAW LINES IN PANEL THROUGH POINTS
             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);

         }
     }
 }



谢谢.:confused:



Thanks.:confused:

推荐答案

如果您有可移动的UI元素,则需要响应处理移动完成的事件(或-前进的运动).

发生这种情况时,您需要调用绘制线条的代码.您应该能够使图形表面无效或在图形表面上调用适当的刷新方法.

干杯.
If you have UI elements that are movable then you will need to respond to the event that handles the completion of the move (or the in-progress movement).

When that happens, you need to call the code that draws the lines. You should be able to invalidate the drawing surface or invoke the appropriate refresh method on your drawing surface.

Cheers.


这篇关于做搬家参考?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆