Пример #1
0
        public void Draw(Graphics g, PointF pntDrawOffset, Point pntMouseLocation, MouseButtons mbButtons, BattlemapViewTools SelectedTool)
        {
            this.m_SelectedTool = SelectedTool;

            if (SelectedTool == BattlemapViewTools.Zones && this.IsMapZonePointSelected == false && this.m_isMouseDown == true && this.m_pntPreviousMouseLocation != null && mbButtons == MouseButtons.Left)
            {
                this.translate(pntMouseLocation.X - this.m_pntPreviousMouseLocation.X, pntMouseLocation.Y - this.m_pntPreviousMouseLocation.Y);
            }

            if (this.m_zoneBackground == null)
            {
                this.m_zoneBackground = new LinearGradientBrush(new RectangleF(0.0F, 0.0F, 30.0F, 30.0F), Color.RoyalBlue, Color.FromArgb(64, Color.WhiteSmoke), LinearGradientMode.ForwardDiagonal);
                this.m_zoneBackground.SetSigmaBellShape(0.5f, 1.0f);
            }

            if (this.m_zoneFadedBackground == null)
            {
                this.m_zoneFadedBackground = new LinearGradientBrush(new RectangleF(0.0F, 0.0F, 30.0F, 30.0F), Color.FromArgb(64, Color.RoyalBlue), Color.FromArgb(64, Color.WhiteSmoke), LinearGradientMode.ForwardDiagonal);
                this.m_zoneFadedBackground.SetSigmaBellShape(0.5f, 1.0f);
            }

            //g.FillRectangle(this.m_zoneBackground, g.ClipBounds);

            this.ObjectPath = new GraphicsPath();
            this.ObjectPath.AddPolygon(this.ToPointFArray());
            this.ObjectPath.CloseAllFigures();
            //this.DrawBwShape(g, gpZoneBackground, 0.2F, 4.0F, Color.Black, Color.Honeydew);

            base.Draw(g, pntDrawOffset, pntMouseLocation, mbButtons);

            if (SelectedTool == BattlemapViewTools.Zones && this.IsSelected == true)
            {
                foreach (MapZonePointControl zonePoint in new List <MapZonePointControl>(this.lstPoints))
                {
                    if (zonePoint.IsPointSelected == true && mbButtons == MouseButtons.Left)
                    {
                        zonePoint.ZonePoint = new PointF(pntMouseLocation.X, pntMouseLocation.Y);

                        zonePoint.Draw(g, pntDrawOffset, pntMouseLocation, mbButtons);
                    }
                    else
                    {
                        if (this.IsMapZonePointSelected == false)
                        {
                            zonePoint.Draw(g, pntDrawOffset, pntMouseLocation, mbButtons);
                        }
                        else
                        {
                            zonePoint.Draw(g, pntDrawOffset, new Point(int.MaxValue, int.MaxValue), mbButtons);
                        }
                    }
                }
            }

            this.m_pntPreviousMouseLocation = pntMouseLocation;
        }
Пример #2
0
        public void Draw(Graphics g, PointF pntDrawOffset, Point pntMouseLocation, MouseButtons mbButtons, BattlemapViewTools SelectedTool)
        {
            this.m_SelectedTool = SelectedTool;

            if (SelectedTool == BattlemapViewTools.Zones && this.IsMapZonePointSelected == false && this.m_isMouseDown == true && this.m_pntPreviousMouseLocation != null && mbButtons == MouseButtons.Left) {
                this.translate(pntMouseLocation.X - this.m_pntPreviousMouseLocation.X, pntMouseLocation.Y - this.m_pntPreviousMouseLocation.Y);
            }

            if (this.m_zoneBackground == null) {
                this.m_zoneBackground = new LinearGradientBrush(new RectangleF(0.0F, 0.0F, 30.0F, 30.0F), Color.RoyalBlue, Color.FromArgb(64, Color.WhiteSmoke), LinearGradientMode.ForwardDiagonal);
                this.m_zoneBackground.SetSigmaBellShape(0.5f, 1.0f);
            }

            if (this.m_zoneFadedBackground == null) {
                this.m_zoneFadedBackground = new LinearGradientBrush(new RectangleF(0.0F, 0.0F, 30.0F, 30.0F), Color.FromArgb(64, Color.RoyalBlue), Color.FromArgb(64, Color.WhiteSmoke), LinearGradientMode.ForwardDiagonal);
                this.m_zoneFadedBackground.SetSigmaBellShape(0.5f, 1.0f);
            }

            //g.FillRectangle(this.m_zoneBackground, g.ClipBounds);

            this.ObjectPath = new GraphicsPath();
            this.ObjectPath.AddPolygon(this.ToPointFArray());
            this.ObjectPath.CloseAllFigures();
            //this.DrawBwShape(g, gpZoneBackground, 0.2F, 4.0F, Color.Black, Color.Honeydew);

            base.Draw(g, pntDrawOffset, pntMouseLocation, mbButtons);

            if (SelectedTool == BattlemapViewTools.Zones && this.IsSelected == true) {

                foreach (MapZonePointControl zonePoint in new List<MapZonePointControl>(this.lstPoints)) {

                    if (zonePoint.IsPointSelected == true && mbButtons == MouseButtons.Left) {
                        zonePoint.ZonePoint = new PointF(pntMouseLocation.X, pntMouseLocation.Y);

                        zonePoint.Draw(g, pntDrawOffset, pntMouseLocation, mbButtons);
                    }
                    else {
                        if (this.IsMapZonePointSelected == false) {
                            zonePoint.Draw(g, pntDrawOffset, pntMouseLocation, mbButtons);
                        }
                        else {
                            zonePoint.Draw(g, pntDrawOffset, new Point(int.MaxValue, int.MaxValue), mbButtons);
                        }
                    }
                }
            }

            this.m_pntPreviousMouseLocation = pntMouseLocation;
        }