Exemplo n.º 1
0
        private void panel_canvas_MouseDown(object sender, MouseEventArgs e)
        {
            if (selectFurn != 0)
            {
                label_status.Text = "furniture를 선택함";
                Room room = RoomMaker.CheckInnerPoint(new Point(e.X, e.Y));
                if (room != null)
                {
                    f.imgSize.X = e.X; f.imgSize.Y = e.Y;
                    if (RoomMaker.PushFurniture(f) == 1)
                    {
                        selectFurn = 0;
                    }
                }
            }
            if (isDoor)
            {
                RoomMaker.PushDoor(new Point(e.X, e.Y), true);
                isRect            = false;
                isPolygon         = false;
                label_status.Text = "door를 선택함";
            }
            if (isWindow)
            {
                RoomMaker.PushDoor(new Point(e.X, e.Y), false);
                isRect            = false;
                isPolygon         = false;
                label_status.Text = "window를 선택함";
            }

            if (isPolygon)
            {
                label_status.Text = "polygon을 선택함";
                if (!isLine)
                {
                    sp     = e.Location;
                    ep     = e.Location;
                    isLine = true;
                    RoomMaker.PushVertex(ref sp);
                }
                else
                {
                    ep = e.Location;
                    int result = RoomMaker.PushVertex(ref ep);
                    if (result == 1)
                    {
                        isPolygon = false;
                        isLine    = false;
                    }
                    else if (result == -1)
                    {
                        isPolygon = false;
                        isLine    = false;
                    }
                    sp = ep;
                }
            }
            else
            {
                sp = e.Location;
            }

            if (e.Button == MouseButtons.Right)
            {
                contextMenuStrip1.Show(new Point(MousePosition.X, MousePosition.Y));
            }


            isDraw = true;
            if (isCreateMenu == 3)
            {
                if (isMove)
                {
                    moveStartPoint = new Point(e.X, e.Y);
                    isMovingDraw   = true;
                }
                else
                {
                    selected_room = RoomMaker.CheckInnerPoint(new Point(e.X, e.Y));
                    if (selected_room == null)
                    {
                        Debug.WriteLine("Room not selected");
                    }
                    else
                    {
                        label_status.Text = "Edit Mode : Room을 선택함";
                    }
                    contextMenuStrip3.Show(new Point(MousePosition.X, MousePosition.Y));

                    panel_canvas.Refresh();
                }
            }
        }