Ejemplo n.º 1
0
        public MapPanelShow DrawImagenaryAndBlock(Graphics g)
        {
            if (mapEditor.Imaginary == true)
            {
                Pen pen1 = new Pen(mapEditor.MapImColor);
                pen1.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;
                int OldX = mapEditor.ImLineXOld;
                int OldY = mapEditor.ImLineYOld;
                int NowX = mapEditor.ImLineXNow;
                int NowY = mapEditor.ImLineYNow;

                g.DrawLines(pen1, mapEditor.GetRectanglePointsFromDiagonalPoints(
                                new Point(OldX, OldY), new Point(NowX, NowY)));

                SolidBrush sb = new SolidBrush(Color.FromArgb(100, Color.Blue));
                g.FillRectangle(sb, mapEditor.GetExpandRectangleFromDiagonalPoints(
                                    new Point(OldX, OldY), new Point(NowX, NowY)));
            }
            if (mapEditor.ImagBlockCus == true)
            {
                Pen pen1 = new Pen(mapEditor.MapImColor);
                int OldX = mapEditor.ImLineXOld;
                int OldY = mapEditor.ImLineYOld;
                int NowX = mapEditor.ImLineXNow;
                int NowY = mapEditor.ImLineYNow;
                g.DrawLines(pen1, mapEditor.GetExpandRectanglePointsFromDiagonalPoints(
                                new Point(OldX, OldY), new Point(NowX, NowY)));

                SolidBrush sb = new SolidBrush(Color.FromArgb(100, Color.Blue));
                g.FillRectangle(sb, mapEditor.GetExpandRectangleFromDiagonalPoints(
                                    new Point(OldX, OldY), new Point(NowX, NowY)));
            }
            return(this);
        }
Ejemplo n.º 2
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);
                }
            }
        }