예제 #1
0
        public static void ClickEvent(MouseEventArgs e, MapPanelEditor mapEditor, MyPanel.MyPanel control)
        {
            MapPanelMouse.NowUpTime = MapPanelMouse.CurrentTimeMillis;
            if (e.Button == MouseButtons.Right && MapPanelMouse.IsMouseHold() == false)
            {
                Point nowClick = new Point(e.X, e.Y);
                if (mapEditor.ImagBlockCus == true)
                {
                    Point     old = new Point(mapEditor.ImLineXOld, mapEditor.ImLineYOld);
                    Point     now = new Point(mapEditor.ImLineXNow, mapEditor.ImLineYNow);
                    Rectangle rec = mapEditor.GetExpandRectangleFromDiagonalPoints(old, now);

                    if (mapEditor.RectangleContainsPoint(rec, nowClick) == true)
                    {
                        control.MouseRightDownMenu.Show(control, nowClick);
                    }
                    else
                    {
                        mapEditor.DataInit();
                    }
                }
                else
                {
                    control.MouseRightDownMenu.Show(control, nowClick);
                }
            }
        }
예제 #2
0
        static bool JudgeMouseIsInSelectedBlock()
        {
            if (MapEditor.SelectedIndex == -1)
            {
                return(false);
            }
            int       lenth         = MapEditor.PictureSize;
            int       selecteedLeft = MapEditor.MapLeft + MapEditor.SelectedIndex % (MapPanelEditor.RowNum) * lenth;
            int       selectedTop   = MapEditor.MapTop + MapEditor.SelectedIndex / (MapPanelEditor.LineNum) * lenth;
            Rectangle rec           = new Rectangle(selecteedLeft, selectedTop, lenth, lenth);

            if (MapEditor.RectangleContainsPoint(rec, MapEditor.NowMouseMoveLocation) == true &&
                State != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }