Пример #1
0
        private ElementLine DecodeCompLineByDb(DataRow dr)
        {
            ElementLine info = new ElementLine();

            info.Idx       = Convert.ToInt32(dr["lineIdx"]);
            info.Name      = dr["name"].ToString();
            info.oneFoot   = Convert.ToInt32(dr["oneFoot"]);
            info.otherFoot = Convert.ToInt32(dr["otherFoot"]);
            info.LocX      = Convert.ToInt32(dr["locX"]);
            info.LocY      = Convert.ToInt32(dr["locY"]);
            info.LocOtherX = Convert.ToInt32(dr["locOtherX"]);
            info.LocOtherY = Convert.ToInt32(dr["locOtherY"]);
            info.Color     = Color.FromArgb(Convert.ToInt32(dr["color"]));

            return(info);
        }
Пример #2
0
        public UcLine(ElementLine info, Action <int> removeLine, Action <int, Color> changeColor)
        {
            this.LineInfo      = info;
            this.RemoveElement = removeLine;
            this.ChangeColor   = changeColor;

            InitializeComponent();

            if (info.LocOtherX == info.LocX)
            {
                this.Height = Math.Abs(info.LocY - info.LocOtherY);
                this.Width  = Constants.LINE_LINK_WIDTH;
            }
            else
            {
                this.Width  = Math.Abs(info.LocX - info.LocOtherX);
                this.Height = Constants.LINE_LINK_WIDTH;
            }
            this.Location  = new Point(Math.Min(info.LocX, info.LocOtherX), Math.Min(info.LocY, info.LocOtherY));
            this.BackColor = this.LineInfo.Color;
        }