示例#1
0
        public static void DragDropEvent(DragEventArgs e, MapPanelEditor mapEditor, MyPanel.MyPanel MapPanel)
        {
            if (IsFileEnter == false)
            {
                return;
            }
            string path = ((System.Array)e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString();

            FileMap.LoadMapInfo(path, mapEditor);
            MapPanel.Refresh();
        }
示例#2
0
        public static void DownEvent(MouseEventArgs e, MapPanelEditor mapEditor, MyPanel.MyPanel MapPanel)
        {
            MapPanelMouse.NowDownTime = MapPanelMouse.CurrentTimeMillis;
            MapPanel.Focus();
            MapPanelMouse.RecordDownPoint(e, mapEditor);
            MapPanelShow showTemp      = new MapPanelShow(mapEditor);
            int          MapTotalSizeX = showTemp.MapTotalSizeX;
            int          MapTotalSizeY = showTemp.MapTotalSizeY;

            if (e.X >= MapTotalSizeX || e.Y >= MapTotalSizeY)
            {
                return;
            }
            if (e.X < 0 || e.Y < 0)
            {
                return;
            }
            if (e.Button == MouseButtons.Right)
            {
                MapDragPlace.IsEnter = false;
                MapDragPlace.IsOver  = false;
                MoveXOld             = e.X;
                MoveYOld             = e.Y;
                mapEditor.MapDragEN  = true;

                mapEditor.SelectedIndex = MapPanelMouse.DownSelectIndex(e, mapEditor);
            }
            else if (e.Button == MouseButtons.Left)
            {
                SmartPaste.HoverPasteInit();
                mapEditor.SelectedIndex = MapPanelMouse.DownSelectIndex(e, mapEditor);

                MapPanelMouse.ImLineFisrtDown(e, mapEditor);

                mapEditor.Imaginary    = true;
                mapEditor.ImagBlockCus = false;
            }
            else if (e.Button == MouseButtons.Middle)
            {
                mapEditor.ImagBlockCus = false;
                MoveXOld          = e.X;
                MoveYOld          = e.Y;
                mapEditor.Magnify = true;

                mapEditor.SelectedIndex = MapPanelMouse.DownSelectIndex(e, mapEditor);

                MapPanel.Refresh();
            }
        }
示例#3
0
        public static void DragEnterEvent(DragEventArgs e, MapPanelEditor mapEditor, MyPanel.MyPanel MapPanel)
        {
            MapPanel.Focus();
            string path = ((System.Array)e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString();

            if (MyPublicFuntion.StringOperation.GetFileexc(path) ==
                MyPublicFuntion.StringOperation.GetFileexc(new FileMap.FileOperator().MapLoadFilter))
            {
                e.Effect    = DragDropEffects.All;
                IsFileEnter = true;
            }
            else
            {
                IsFileEnter = false;
                e.Effect    = DragDropEffects.None;
            }

            MapPanel.Refresh();
        }
示例#4
0
 public static void DragLeaveEvent(EventArgs e, MapPanelEditor mapEditor, MyPanel.MyPanel MapPanel)
 {
     MapDragPlace.IsEnter = false;
     MapPanel.Refresh();
 }
示例#5
0
        public static void MoveEvent(MouseEventArgs e, MapPanelEditor mapEditor, MyPanel.MyPanel MapPanel,
                                     VScrollBar Map_VScrollBar, HScrollBar Map_HScrollBar)
        {
            mapEditor.NowMouseMoveLocation = new Point(e.X, e.Y);
            if (mapEditor.MapDragEN == false && mapEditor.Magnify == false &&
                mapEditor.Imaginary == false)
            {
                return;
            }

            if (FirstFlag == false)
            {
                FirstFlag = true;
                return;
            }
            if (mapEditor.MapDragEN == true)
            {
                if (mapEditor.PictureSize < 17)
                {
                    return;
                }
                //this.Cursor = Cursors.Hand;
                mapEditor.ImagBlockCus = false;
                try
                {
                    int i = Map_HScrollBar.Value;
                    i = Convert.ToInt32(i - DragSpeed * (e.X - MoveXOld));
                    if (Math.Abs(e.X - MoveXOld) >= 2)
                    {
                        MapPanelMouse.NowDownTime = 0;
                    }
                    if (i >= Map_HScrollBar.Maximum)
                    {
                        Map_HScrollBar.Value = Map_HScrollBar.Maximum;
                    }
                    else if (i <= Map_HScrollBar.Minimum)
                    {
                        Map_HScrollBar.Value = Map_HScrollBar.Minimum;
                    }
                    else
                    {
                        Map_HScrollBar.Value = i;
                    }
                }
                catch
                {
                }
                try
                {
                    int j = Map_VScrollBar.Value;
                    j = Convert.ToInt32(j - DragSpeed * (e.Y - MoveYOld));
                    if (Math.Abs(e.Y - MoveYOld) >= 2)
                    {
                        MapPanelMouse.NowDownTime = 0;
                    }
                    if (j >= Map_VScrollBar.Maximum)
                    {
                        Map_VScrollBar.Value = Map_VScrollBar.Maximum;
                    }
                    else if (j <= Map_VScrollBar.Minimum)
                    {
                        Map_VScrollBar.Value = Map_VScrollBar.Minimum;
                    }
                    else
                    {
                        Map_VScrollBar.Value = j;
                    }
                }
                catch
                {
                }
                mapEditor.MapTop  = -Map_VScrollBar.Value;
                mapEditor.MapLeft = -Map_HScrollBar.Value;
                MapPanel.Refresh();
            }
            if (mapEditor.Magnify == true)
            {
                //this.Cursor = Cursors.Cross;
                int PicSize_Temp = mapEditor.PictureSize;
                mapEditor.PictureSize = Convert.ToInt32(PicSize_Temp - 0.1 * (e.Y - MoveYOld));
                if (mapEditor.PictureSize >= 90)
                {
                    mapEditor.PictureSize = 90;
                }
                if (mapEditor.PictureSize <= 10)
                {
                    mapEditor.PictureSize = 10;
                }
            }
            MoveXOld = e.X;
            MoveYOld = e.Y;
            if (mapEditor.Imaginary == true)
            {
                int MapTotalSizeX = mapEditor.PictureSize * MapPanelEditor.RowNum + mapEditor.MapLeft;
                int MapTotalSizeY = mapEditor.PictureSize * MapPanelEditor.RowNum + mapEditor.MapTop;
                if (e.X >= MapTotalSizeX || e.Y >= MapTotalSizeY)
                {
                    return;
                }
                if (e.X < 0 || e.Y < 0)
                {
                    return;
                }
                mapEditor.ImLineXNow = e.X;
                mapEditor.ImLineYNow = e.Y;

                MapPanel.Refresh();
            }
        }