Пример #1
0
 public void MoveChild(Point move)
 {
     foreach (Control c in Parent.Controls)
     {
         c.Location = PointUtil.Plus(c.Location, move);
     }
 }
Пример #2
0
        private void makeDoor(int idx, bool isDoor)
        {
            GlobalEvent.OnDocumentChangeBefore(Canvas.instance.GetCurrent(), "add door");
            if (isVertical)
            {
                loc.X = 2;
            }
            else
            {
                loc.Y = 2;
            }

            Point newLoc = PointUtil.Plus(this.Location, loc);

            if (isVertical && newLoc.Y + 50 > this.Bottom)
            {
                return;
            }

            if (!isVertical && newLoc.X + 50 > this.Right)
            {
                return;
            }

            Door temp = new Door();

            temp.pA     = newLoc;
            temp.kind   = idx;
            temp.isDoor = isDoor;

            Canvas.instance.MakeDoor(temp);
            Canvas.instance.BindDoorToRoom();

            GlobalEvent.OnDocumentChangeAfter(Canvas.instance.GetCurrent(), "add door");
        }
        public override void PointerMove(object sender, MouseEventArgs e)
        {
            if (isClick)
            {
                Point dPoint = PointUtil.Minus(PointToScreen(e.Location), mouse0);
                //Console.WriteLine("delta : " + dPoint.X + ", " + dPoint.Y);
                //Console.WriteLine("room : " + thisRoom.Location.X + ", " + thisRoom.Location.Y);
                switch (where)
                {
                case Where.leftbottom:
                    thisRoom.Location = new Point(location0.X + dPoint.X, location0.Y);
                    thisRoom.Size     = new Size(size0.Width - dPoint.X, size0.Height + dPoint.Y);
                    break;

                case Where.lefttop:
                    thisRoom.Location = PointUtil.Plus(location0, dPoint);
                    thisRoom.Size     = new Size(PointUtil.Minus(new Point(size0), dPoint));
                    break;

                case Where.rightbottom:
                    thisRoom.Size = new Size(PointUtil.Plus(new Point(size0), dPoint));
                    break;

                case Where.righttop:
                    thisRoom.Location = new Point(location0.X, location0.Y + dPoint.Y);
                    thisRoom.Size     = new Size(size0.Width + dPoint.X, size0.Height - dPoint.Y);
                    break;

                default:
                    break;
                }
                thisRoom.UpdateScalerPosition();
            }
        }
Пример #4
0
 public void Setup(Door d)
 {
     pA     = d.pA;
     kind   = d.kind;
     isDoor = d.isDoor;
     if (kind % 2 == 0)
     {
         pB = PointUtil.Plus(pA, new Point(0, 50));
     }
     else
     {
         pB = PointUtil.Plus(pA, new Point(50, 0));
     }
 }
Пример #5
0
        public UCDoor MakeDoor(Door door)
        {
            UCDoor uDoor = new UCDoor();

            this.Controls.Add(uDoor);
            this.Controls.SetChildIndex(uDoor, 0);

            uDoor.pA       = door.pA;
            uDoor.Location = uDoor.pA;
            uDoor.kind     = door.kind;
            uDoor.pB       = uDoor.pA;
            uDoor.isDoor   = door.isDoor;
            if (door.kind % 2 == 0)
            {
                uDoor.pB = PointUtil.Plus(door.pB, new Point(0, 50));
            }
            else
            {
                uDoor.pB = PointUtil.Plus(door.pB, new Point(50, 0));
            }

            if (door.isDoor)
            {
                switch (door.kind)
                {
                case 0:                         // right
                    uDoor.BackgroundImage = Properties.Resources.rDoor0;
                    break;

                case 1:                         // up
                    uDoor.BackgroundImage = Properties.Resources.rDoor1;
                    uDoor.Location        = PointUtil.Minus(uDoor.Location, new Point(0, 50));
                    break;

                case 2:                         // left
                    uDoor.BackgroundImage = Properties.Resources.rDoor2;
                    uDoor.Location        = PointUtil.Minus(uDoor.Location, new Point(50, 0));
                    break;

                case 3:
                    uDoor.BackgroundImage = Properties.Resources.rDoor3;
                    break;
                }
            }
            else
            {
                if (uDoor.kind % 2 == 0)
                {
                    uDoor.BackgroundImage = Properties.Resources.rWindow1;
                    uDoor.Location        = PointUtil.Minus(uDoor.Location, new Point(10, 0));
                    uDoor.Size            = new Size(new Point(20, 50));
                }
                else
                {
                    uDoor.BackgroundImage = Properties.Resources.rWindow0;
                    uDoor.Location        = PointUtil.Minus(uDoor.Location, new Point(0, 10));
                    uDoor.Size            = new Size(new Point(50, 20));
                }
            }
            m_listDoor.Add(uDoor);

            return(uDoor);
        }
Пример #6
0
 public void Dragging(Point dP)
 {
     pA       = PointUtil.Plus(startPoint, dP);
     Location = PointUtil.Plus(startLoc, dP);
 }