Example #1
0
 public void Paste(string str)
 {
     if (CutAndCopyObjectList.Count > 0)
     {
         if (_CutOrCopy == CutOrCopy.CutOp)
         {
             int n = selectedDrawObjectList.Count;
             foreach (BaseRailEle obj in selectedDrawObjectList)
             {
                 drawObjectList.Remove(obj);
             }
         }
         else if (_CutOrCopy == CutOrCopy.CopyOp)
         {
             BaseRailEle o = CutAndCopyObjectList[0];
             if (1 == o.GraphType)
             {
                 StraightRailEle cl = (StraightRailEle)o;
                 StraightRailEle n  = (StraightRailEle)cl.Clone(str);
                 drawObjectList.Add(n);
                 SelectOne(n);
             }
             else if (2 == o.GraphType)
             {
                 CurvedRailEle cl = (CurvedRailEle)o;
                 CurvedRailEle n  = (CurvedRailEle)cl.Clone(str);
                 drawObjectList.Add(n);
                 SelectOne(n);
             }
             else if (3 == o.GraphType)
             {
                 CrossEle cl = (CrossEle)o;
                 CrossEle n  = (CrossEle)cl.Clone(str);
                 drawObjectList.Add(n);
                 SelectOne(n);
             }
             else if (4 == o.GraphType)
             {
                 RailLabal cl = (RailLabal)o;
                 RailLabal n  = (RailLabal)cl.Clone();
                 drawObjectList.Add(n);
                 SelectOne(n);
             }
             CutAndCopyObjectList.RemoveAt(0);
         }
     }
 }
Example #2
0
        public object Clone()
        {
            RailLabal cl = new RailLabal();
            Point     pt = rect.Location;

            pt.Offset(10, 10);
            cl.rect            = rect;
            cl.rect.Location   = pt;
            cl.DrawMultiFactor = DrawMultiFactor;
            cl.Font            = font;
            cl.GraphType       = GraphType;
            cl.LocationLock    = locationLock;
            cl.RectOrigionLoca = RectOrigionLoca;
            cl.SizeLock        = SizeLock;
            cl.Text            = text;
            cl.objectLabelOp.DrawMultiFactor = DrawMultiFactor;
            this.railText = railText;
            return(cl);
        }
Example #3
0
 private void addtext_Click(object sender, EventArgs e)
 {
     BaseRailElement.RailLabal railLalal = new BaseRailElement.RailLabal();
     //        railLalal.CreatEle(multiFactor, this.tools.itemSelected.Text);
     //        railLalal.CreatEle(multiFactor, null);
     //        this.drawDoc.DrawObjectList.Add(railLalal.CreatEle(multiFactor, this.tools.itemSelected.Text));
     this.drawDoc.DrawObjectList.Add(railLalal.CreatEle(multiFactor, null));
     drawDoc.SelectOne(railLalal);
     proRegion.AddElementNode(this.workRegion.Text, railLalal.railText);
     this.workRegion.pictureBox1.Invalidate();
     proPage.propertyGrid1.SelectedObject = railLalal;
     proPage.propertyGrid1.Refresh();
 }
Example #4
0
        public override void OnMouseMove(Point point)
        {
            int dx = point.X - lastPoint.X;
            int dy = point.Y - lastPoint.Y;
            int n  = document.SelectedDrawObjectList.Count;
            int tempDrawMultiFactor = 1;

            switch (selectObject)
            {
            case SelectObject.SelectHandle:
                tempDrawMultiFactor = document.SelectedDrawObjectList[0].DrawMultiFactor;
                if ((dx != 0 && dx / tempDrawMultiFactor != 0) || (dy != 0 && dy / tempDrawMultiFactor != 0))
                {
                    if (document.SelectedDrawObjectList[0].GraphType == 1)
                    {
                        if (n == 1)
                        {
                            document.SelectedDrawObjectList[0].MoveHandle(_hit, lastPoint, point);
                        }
                    }
                    else if (document.SelectedDrawObjectList[0].GraphType == 2)
                    {
                        if (n == 1)
                        {
                            document.SelectedDrawObjectList[0].MoveHandle(_hit, lastPoint, point);
                        }
                    }
                    else if (document.SelectedDrawObjectList[0].GraphType == 3)
                    {
                        if (n == 1)
                        {
                            document.SelectedDrawObjectList[0].MoveHandle(_hit, lastPoint, point);
                        }
                    }
                    else if (document.SelectedDrawObjectList[0].GraphType == 4)
                    {
                        if (n == 1)
                        {
                            document.SelectedDrawObjectList[0].MoveHandle(_hit, lastPoint, point);
                        }
                    }
                    lastPoint.Offset(dx / tempDrawMultiFactor * tempDrawMultiFactor, dy / tempDrawMultiFactor * tempDrawMultiFactor);
                }
                break;

            case SelectObject.SelectEle:
                tempDrawMultiFactor = document.SelectedDrawObjectList[0].DrawMultiFactor;
                if ((dx != 0 && dx / tempDrawMultiFactor != 0) || (dy != 0 && dy / tempDrawMultiFactor != 0))
                {
                    for (int i = 0; i < n; i++)
                    {
                        if (document.SelectedDrawObjectList[i].GraphType == 1)
                        {
                            StraightRailEle de = (StraightRailEle)document.SelectedDrawObjectList[i];
                            document.SelectedDrawObjectList[i].Move(lastPoint, point);
                        }
                        else if (document.SelectedDrawObjectList[i].GraphType == 2)
                        {
                            CurvedRailEle de = (CurvedRailEle)document.SelectedDrawObjectList[i];
                            document.SelectedDrawObjectList[i].Move(lastPoint, point);
                        }
                        else if (document.SelectedDrawObjectList[i].GraphType == 3)
                        {
                            CrossEle de = (CrossEle)document.SelectedDrawObjectList[i];
                            document.SelectedDrawObjectList[i].Move(lastPoint, point);
                        }
                        else if (document.SelectedDrawObjectList[i].GraphType == 4)
                        {
                            RailLabal de = (RailLabal)document.SelectedDrawObjectList[i];
                            document.SelectedDrawObjectList[i].Move(lastPoint, point);
                        }
                    }
                    lastPoint.Offset(dx / tempDrawMultiFactor * tempDrawMultiFactor, dy / tempDrawMultiFactor * tempDrawMultiFactor);
                }
                break;

            case SelectObject.SelectNone:
                document.ChangeChooseSign(true, point);
                base.OnMouseMove(point);
                break;
            }
            Debug.WriteLine(string.Format("move pt is {0} lastpoint is {1} tempDrawMultiFactor is {2}", point, lastPoint, tempDrawMultiFactor));
        }