예제 #1
0
        /// <summary>
        /// 根据Evolution节点信息,设置CGNode属性(用到前驱节点的位置信息及轮次信息)
        /// </summary>
        /// <param name="curEle"></param>
        /// <param name="preNode">前驱节点决定横向位置</param>
        /// <param name="roundNum">轮次决定位置</param>
        public void Set(XmlElement curNode, XmlElement curEle, CGNode preNode, int roundNum, string curTags)
        {
            #region 设置内容
            evoid        = Int32.Parse(curNode.GetAttribute("id"));
            cgMapid      = Int32.Parse(((XmlElement)curNode.SelectSingleNode("CGMapInfo")).GetAttribute("id"));
            info.version = curEle.GetAttribute("filename");
            info.id      = curEle.GetAttribute("cgid");
            info.size    = Int32.Parse(curEle.GetAttribute("size"));
            #endregion

            #region 设置位置
            int top, bottom;
            top = rowY + rowDis;
            if (preNode == null && roundNum == 1)   //如果是第一个节点
            {
                center.X = 80;
            }
            else
            {
                center.X = preNode.center.X + distanceHor;   //横向右移
                if (center.X > rowX)
                {
                    rowX = center.X;
                }
            }

            cfNum             = Int32.Parse(curEle.GetAttribute("size"));
            cftag             = curTags;
            cfNodes           = new CFNode[cfNum]; //建立CFNode数组
            cfNodes[0]        = new CFNode();
            cfNodes[0].center = new Point(center.X, top + 11);
            for (int i = 1; i < cfNum; i++)
            {
                cfNodes[i] = new CFNode();
                //CF中心下移15
                cfNodes[i].center = new Point(center.X, top + 11 + i * cfNodeCenterDis);
            }
            bottom = cfNodes[cfNum - 1].center.Y + 11;   //bottom为最后一个CFNode中心下移11

            height   = bottom - top - 2;
            center.Y = top + 1 + (int)(0.5 * height);
            rect     = new Rectangle(center.X - (int)(0.5 * width), top + 1, width, height);
            #endregion
        }
예제 #2
0
 public void Init()
 {
     //初始化画笔画刷
     pen1   = new Pen(Color.CornflowerBlue, 2);
     pen2   = new Pen(Color.CornflowerBlue, 1);
     pen3   = new Pen(Color.LightSalmon, 1);
     pen4   = new Pen(Color.HotPink, 2);
     brush1 = new SolidBrush(Color.Aqua);
     brush2 = new SolidBrush(Color.LightSkyBlue);
     brush3 = new SolidBrush(Color.Aqua);
     brush4 = new SolidBrush(Color.PaleVioletRed);
     font1  = new Font("Arial", 10);
     brush5 = new SolidBrush(Color.Black);
     //定义标签集
     tagSet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
     //初始化画布
     this.Dock      = DockStyle.Fill;
     this.BackColor = Color.White;
     this.Visible   = true;
     //设置CGNode和CFNode的基本属性
     CGNode.SetBase();
     CFNode.SetBase();
 }