Esempio n. 1
0
        private void BenPanel_Paint(object sender, PaintEventArgs e)
        {
            int w = BenPanel.Width / ReturnMasSize();
            int h = BenPanel.Height / ReturnMasSize();

            ControlPaint.DrawGrid(e.Graphics, new Rectangle(Point.Empty, BenPanel.Size), new Size(w, 1), Color.White);
            ControlPaint.DrawGrid(e.Graphics, new Rectangle(Point.Empty, BenPanel.Size), new Size(1, h), Color.White);
            for (int i = 0; i < ReturnMasSize(); i++)
            {
                for (int j = 0; j < ReturnMasSize(); j++)
                {
                    if (ben[i][j] == 0)
                    {
                        e.Graphics.FillRectangle(Brushes.White, j * w + 1, i * h + 1, w - 1, h - 1);
                    }
                    if (ben[i][j] == 2 || ben[i][j] == 1)
                    {
                        e.Graphics.FillRectangle(Brushes.Navy, j * w + 1, i * h + 1, w - 1, h - 1);
                    }
                    if (ben[i][j] == 4)
                    {
                        e.Graphics.FillRectangle(Brushes.LightCoral, j * w + 1, i * h + 1, w - 1, h - 1);
                    }
                    if (ben[i][j] == 3)
                    {
                        e.Graphics.FillRectangle(Brushes.Red, j * w + 1, i * h + 1, w - 1, h - 1);
                    }
                }
            }
        }
Esempio n. 2
0
        private void DusmanPanel_Paint(object sender, PaintEventArgs e)
        {
            int w = BenPanel.Width / ReturnMasSize();
            int h = BenPanel.Height / ReturnMasSize();

            ControlPaint.DrawGrid(e.Graphics, new Rectangle(Point.Empty, BenPanel.Size), new Size(w, 1), Color.White);
            ControlPaint.DrawGrid(e.Graphics, new Rectangle(Point.Empty, BenPanel.Size), new Size(1, h), Color.White);
            for (int i = 0; i < ReturnMasSize(); i++)
            {
                for (int j = 0; j < ReturnMasSize(); j++)
                {
                    if (GetEnemyValue(i, j) < 3)
                    {
                        e.Graphics.FillRectangle(Brushes.White, j * w + 1, i * h + 1, w - 1, h - 1);
                    }

                    /*if (objBattle.GetEnemyValue(i, j) == 2)
                     * e.Graphics.FillRectangle(Brushes.Red, j * w + 1, i * h + 1, w - 1, h - 1);*/
                    if (GetEnemyValue(i, j) == 3)
                    {
                        e.Graphics.FillRectangle(Brushes.Red, j * w + 1, i * h + 1, w - 1, h - 1);
                    }
                    if (GetEnemyValue(i, j) == 4)
                    {
                        e.Graphics.FillRectangle(Brushes.LightCoral, j * w + 1, i * h + 1, w - 1, h - 1);
                    }
                }
            }
        }
        /// <include file='doc\GroupBoxDesigner.uex' path='docs/doc[@for="GroupBoxDesigner.OnPaintAdornments"]/*' />
        /// <devdoc>
        ///      We override this because even though we still want to
        ///      offset our grid for our display rectangle, we still want
        ///      to align to our parent's grid - so we don't look funny
        /// </devdoc>
        protected override void OnPaintAdornments(PaintEventArgs pe)
        {
            if (DrawGrid)
            {
                Control   control   = (Control)Control;
                Rectangle rectangle = Control.DisplayRectangle;

                rectangle.Width++; // gpr: FillRectangle with a TextureBrush comes up one pixel short
                rectangle.Height++;
                ControlPaint.DrawGrid(pe.Graphics, rectangle, GridSize, control.BackColor);
            }

            // If this control is being inherited, paint it
            //
            if (Inherited)
            {
                if (inheritanceUI == null)
                {
                    inheritanceUI = (InheritanceUI)GetService(typeof(InheritanceUI));
                }

                if (inheritanceUI != null)
                {
                    pe.Graphics.DrawImage(inheritanceUI.InheritanceGlyph, 0, 0);
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 드로우에리어 페인트 오버라이드
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DrawArea_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
        {
            SolidBrush brush = new SolidBrush(Color.FromArgb(255, 255, 255));

            e.Graphics.FillRectangle(brush, this.ClientRectangle);

            if (Mgr.Flolist.Count > 0 || Mgr.Gudcon != null || Mgr.Gudsrt != null)
            {
                FLOObj o = Mgr.Flolist.GetFLOSttObj();

                if (o != null && o.Drwobj == null)
                {
                    o.Drwobj = new DRWStt(o, this.ClientRectangle.Right, this.ClientRectangle.Top);
                }

                Mgr.Draw(e.Graphics);
            }

            if (this.Mgr.Gudsrt.GridpointX != 1)
            {
                ControlPaint.DrawGrid(e.Graphics, this.ClientRectangle, new Size((this.Mgr.Gudsrt.GridpointX), (this.Mgr.Gudsrt.GridpointY)), Color.Gray);
            }

            this.owner.statusBar1.Text = this.Mgr.Gudsrt.Seldraw.ToString();

            brush.Dispose();
        }
Esempio n. 5
0
 private void ControlContainer_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
 {
     if (!this.TopLevel)
     {
         ControlPaint.DrawGrid(e.Graphics, this.ClientRectangle, new Size(8, 8), Color.White);
     }
 }
Esempio n. 6
0
 protected override void OnPaint(PaintEventArgs e)
 {
     if (PaintGrid)
     {
         ControlPaint.DrawGrid(e.Graphics, ClientRectangle, GridSize, Color.Transparent);
     }
 }
Esempio n. 7
0
 protected override void OnPaint(PaintEventArgs e)
 {
     if (!this.TopLevel)
     {
         ControlPaint.DrawGrid(e.Graphics, this.ClientRectangle, new Size(10, 10), Color.White); //绘制底层网格White
     }
     base.OnPaint(e);
 }
Esempio n. 8
0
        protected override void OnPaintBackground(PaintEventArgs e)
        {
            base.OnPaintBackground(e);
            Graphics g = e.Graphics;

            if (showGrid)
            {
                ControlPaint.DrawGrid(g, this.ClientRectangle, gridSize, this.BackColor);
            }
        }
Esempio n. 9
0
        private void button1_Click(object sender, EventArgs e)
        {
            Pen mypen = new Pen(Color.Black);

            g = Canvas.CreateGraphics();
            SolidBrush brush = new SolidBrush(Color.Gray);

            g.FillEllipse(brush, 50, 50, 25, 25);

            ControlPaint.DrawGrid(g, new Rectangle(50, 50, 900, 500), new Size(10, 10), Color.Red);
        }
Esempio n. 10
0
        /// <summary>
        /// Draws shapes and other.
        /// </summary>
        /// <param name="shapes">Shapes to draw.</param>
        /// <param name="e">PaintEventArgs.</param>
        protected void Painting(ShapeCollection shapes, PaintEventArgs e)
        {
            if (_gridManager.Resolution != Size.Empty)
            {
                ControlPaint.DrawGrid(e.Graphics, e.ClipRectangle, Size.Round(_gridManager.Resolution), BackColor);
            }

            foreach (IShape shape in shapes)
            {
                shape.Paint(this, e);
            }
        }
Esempio n. 11
0
        private void VelDisplay_Paint(object sender, PaintEventArgs e)
        {
            //this.AutoScrollMinSize = new Size(ClientRectangle.Width, ClientRectangle.Height);
            //绘制虚线表格
            Graphics myGra = VelDisplay.CreateGraphics();

            Pen myPen = new Pen(Color.Black, 1);

            myPen.EndCap = LineCap.ArrowAnchor;

            //绘画栅格
            ControlPaint.DrawGrid(e.Graphics, this.ClientRectangle, new Size(20, 20), Color.White);

            //绘制坐标系中心
            AdjustableArrowCap myLineCap = new AdjustableArrowCap(3, 3, true);

            myPen.CustomEndCap = myLineCap;
            myGra.DrawLine(myPen, 10, VelDisplay.Bottom, 10, 5);
            myGra.DrawLine(myPen, 0, VelDisplay.Bottom / 2, VelDisplay.Right - 10, VelDisplay.Bottom / 2);

            switch (VelDisplayBox.Text)
            {
            case "1号轮速度":
            case "2号轮速度":
            case "3号轮速度":
            case "全部速度":
                WheelVelCurveDrawing();
                单位.Text = "mm/s";
                break;

            case "合速度":
            case "合速度方向":
            case "旋转速度":
                ResultantVelCurveDrawing();

                break;

            case "位置误差":
                ErrCurveDrawing();
                ResultantVelCurveDrawing();
                单位.Text = "mm";
                break;

            default:
                break;
            }


            //ErrCurveDrawing();
        }
Esempio n. 12
0
        //static bool onPaintBackgroundFlag = false;
        protected override void OnPaintBackground(PaintEventArgs e)
        {
            //if (onPaintBackgroundFlag) return;
            //onPaintBackgroundFlag = true;

            base.OnPaintBackground(e);
            Graphics g = e.Graphics;

            if (showGrid)
            {
                ControlPaint.DrawGrid(g, this.ClientRectangle, gridSize, this.BackColor);
            }

            //onPaintBackgroundFlag = false;
        }
Esempio n. 13
0
        /// <summary>
        /// Called when the control that the designer is managing has painted its surface so the designer can paint any additional adornments on top of the control.
        /// </summary>
        /// <param name="pe">A <see cref="System.Windows.Forms.PaintEventArgs"/> that provides data for the event.</param>
        protected override void OnPaintAdornments(PaintEventArgs pe)
        {
            if (this.Control is GoogleTalkForm && this.DrawGrid == true)
            {
                GoogleTalkForm control = (GoogleTalkForm)this.Control;
                Rectangle      rect    = control.BodyRectangle;
                rect.X++;
                rect.Width++;
                rect.Height++;

                ControlPaint.DrawGrid(pe.Graphics, rect, this.GridSize, control.BackColor);
            }
            else
            {
                base.OnPaintAdornments(pe);
            }
        }
Esempio n. 14
0
        private void pictureBox1_Paint(object sender, PaintEventArgs e)
        {
            for (int dim1 = 0; dim1 < bMainArr.GetLength(0); dim1++)
            {
                for (int dim2 = 0; dim2 < bMainArr.GetLength(1); dim2++)
                {
                    if (bMainArr[dim1, dim2])
                    {
                        SolidBrush brush = new SolidBrush(cellColor);
                        Rectangle  rec   = new Rectangle(dim1 * xOffSet / resolutionFaktor, dim2 * yOffSet / resolutionFaktor, xOffSet / resolutionFaktor, yOffSet / resolutionFaktor);
                        e.Graphics.FillRectangle(brush, rec);
                    }
                }
            }

            ControlPaint.DrawGrid(e.Graphics, new Rectangle(0, 0, pictureBox1.Width, pictureBox1.Height), new Size(1, yOffSet / resolutionFaktor), Color.White);
            ControlPaint.DrawGrid(e.Graphics, new Rectangle(0, 0, pictureBox1.Width, pictureBox1.Height), new Size(xOffSet / resolutionFaktor, 1), Color.White);
        }
Esempio n. 15
0
        private void VisualGraph_Paint(object sender, PaintEventArgs e)
        {
            e.Graphics.PageUnit  = GraphicsUnit.Pixel;
            e.Graphics.PageScale = M_Scalef;

            SolidBrush brush = new SolidBrush(_backColor);

            e.Graphics.FillRectangle(brush, this.ClientRectangle);
            if (ShowGrid)
            {
                ControlPaint.DrawGrid(e.Graphics, this.ClientRectangle, gridSize, this.BackColor);
            }
            if (objList != null)
            {
                ObjList.Draw(e.Graphics, this);
            }
            DrawSelectAll(e.Graphics);
            brush.Dispose();
        }
        // Draws the design-time grid if DrawGrid == true
        //
        protected override void OnPaintAdornments(PaintEventArgs pe)
        {
            base.OnPaintAdornments(pe);

            bool drawGrid;
            Size gridSize;

            // in case WM_PAINT is received before the IDesignerFilter is invoked to add
            // those properties.
            try
            {
                drawGrid = (bool)GetValue(this.Component, "DrawGrid");
            }
            catch
            {
                drawGrid = this.DrawGrid;
            }
            try
            {
                gridSize = (Size)GetValue(this.Component, "GridSize");
            }
            catch
            {
                gridSize = this.GridSize;
            }

            if (drawGrid)
            {
                GraphicsState state = pe.Graphics.Save();
                pe.Graphics.TranslateTransform(this.Control.ClientRectangle.X,
                                               this.Control.ClientRectangle.Y);
                ControlPaint.DrawGrid(pe.Graphics, this.Control.ClientRectangle, gridSize, this.Control.BackColor);
                pe.Graphics.Restore(state);
            }

            IUISelectionService selection = this.GetService(typeof(IUISelectionService)) as IUISelectionService;

            if (selection != null)
            {
                selection.PaintAdornments(this.Control, pe.Graphics);
            }
        }
Esempio n. 17
0
        private void ControlPaintTest_Paint(object sender, PaintEventArgs e)
        {
            ControlPaint.DrawCheckBox(e.Graphics, new Rectangle(10, 10, 50, 50), ButtonState.Checked);
            ControlPaint.DrawCheckBox(e.Graphics, new Rectangle(70, 10, 30, 30), ButtonState.Normal);
            ControlPaint.DrawCheckBox(e.Graphics, new Rectangle(110, 10, 20, 20), ButtonState.Checked);

            ControlPaint.DrawButton(e.Graphics, new Rectangle(10, 80, 20, 20), ButtonState.Checked);
            ControlPaint.DrawButton(e.Graphics, new Rectangle(50, 80, 20, 20), ButtonState.Flat);
            ControlPaint.DrawButton(e.Graphics, new Rectangle(90, 80, 20, 20), ButtonState.Normal);
            ControlPaint.DrawFocusRectangle(e.Graphics, new Rectangle(130, 80, 20, 20));

            ControlPaint.DrawGrid(e.Graphics, new Rectangle(10, 120, 250, 50), new Size(5, 5), Color.Blue);
            ControlPaint.DrawScrollButton(e.Graphics, new Rectangle(10, 180, 20, 20), ScrollButton.Left, ButtonState.Normal);
            ControlPaint.DrawScrollButton(e.Graphics, new Rectangle(50, 180, 20, 20), ScrollButton.Max, ButtonState.Pushed);
            ControlPaint.DrawScrollButton(e.Graphics, new Rectangle(90, 180, 20, 20), ScrollButton.Up, ButtonState.Normal);

            ControlPaint.DrawMenuGlyph(e.Graphics, new Rectangle(10, 220, 20, 20), MenuGlyph.Arrow);
            ControlPaint.DrawMenuGlyph(e.Graphics, new Rectangle(50, 220, 20, 20), MenuGlyph.Checkmark);
            ControlPaint.DrawMenuGlyph(e.Graphics, new Rectangle(90, 220, 20, 20), MenuGlyph.Max);
        }
Esempio n. 18
0
        //private /*InheritanceUI*/ object inheritanceUI; //TODO

        protected override void OnPaintAdornments(PaintEventArgs pe)
        {
            if (this.DrawGrid)
            {
                Control   control          = this.Control;
                Rectangle displayRectangle = this.Control.DisplayRectangle;
                displayRectangle.Width++;
                displayRectangle.Height++;
                ControlPaint.DrawGrid(pe.Graphics, displayRectangle, base.GridSize, control.BackColor);
            }
            //if (base.Inherited)
            //{
            //   if (this.inheritanceUI == null)
            //   {
            //      this.inheritanceUI = (InheritanceUI)this.GetService(typeof(InheritanceUI));
            //   }
            //   if (this.inheritanceUI != null)
            //   {
            //      pe.Graphics.DrawImage(this.inheritanceUI.InheritanceGlyph, 0, 0);
            //   }
            //}
        }
Esempio n. 19
0
        private void DrawGridByBrush(Graphics g)
        {
            Rectangle area     = this.ClientRectangle;
            Size      gridsize = new System.Drawing.Size(10, 10);

            switch (this.GridKind)
            {
            case GridMode.DottedGrid:
                ControlPaint.DrawGrid(g, area, gridsize, Color.LightGray);
                break;

            case GridMode.DotLineGrid:
            case GridMode.Grid:
                HatchStyle bstyle = this.GridKind == GridMode.DotLineGrid ? HatchStyle.DottedGrid : HatchStyle.LargeGrid;
                using (HatchBrush hbrush = new HatchBrush(bstyle, Color.Gray, Color.White))
                {
                    g.FillRectangle(hbrush, this.ClientRectangle);
                }
                break;

            default:
                break;
            }
        }
Esempio n. 20
0
        public const int ChunkSize = 8;                 // 8x8 chunks ==> 192x192 bitmaps.

        Bitmap RenderChunk(int u, int v)
        {
            var bitmap = new Bitmap(ChunkSize * TileSet.TileSize, ChunkSize * TileSet.TileSize);

            var data = bitmap.LockBits(bitmap.Bounds(),
                                       ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);

            unsafe
            {
                int *p      = (int *)data.Scan0.ToPointer();
                var  stride = data.Stride >> 2;

                for (var i = 0; i < ChunkSize; i++)
                {
                    for (var j = 0; j < ChunkSize; j++)
                    {
                        var tr       = Map.MapTiles.Value[u * ChunkSize + i, v *ChunkSize + j];
                        var tile     = TileSet.Templates[tr.type].Data;
                        var index    = (tr.index < tile.TileBitmapBytes.Count) ? tr.index : (byte)0;
                        var rawImage = tile.TileBitmapBytes[index];
                        for (var x = 0; x < TileSet.TileSize; x++)
                        {
                            for (var y = 0; y < TileSet.TileSize; y++)
                            {
                                p[(j * TileSet.TileSize + y) * stride + i * TileSet.TileSize + x] = Palette.GetColor(rawImage[x + TileSet.TileSize * y]).ToArgb();
                            }
                        }

                        if (Map.MapResources.Value[u * ChunkSize + i, v *ChunkSize + j].type != 0)
                        {
                            var resourceImage = ResourceTemplates[Map.MapResources.Value[u * ChunkSize + i, v *ChunkSize + j].type].Bitmap;
                            var srcdata       = resourceImage.LockBits(resourceImage.Bounds(),
                                                                       ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);

                            int *q         = (int *)srcdata.Scan0.ToPointer();
                            var  srcstride = srcdata.Stride >> 2;

                            for (var x = 0; x < TileSet.TileSize; x++)
                            {
                                for (var y = 0; y < TileSet.TileSize; y++)
                                {
                                    var c = q[y * srcstride + x];
                                    if ((c & 0xff000000) != 0)                                          /* quick & dirty, i cbf doing real alpha */
                                    {
                                        p[(j * TileSet.TileSize + y) * stride + i * TileSet.TileSize + x] = c;
                                    }
                                }
                            }

                            resourceImage.UnlockBits(srcdata);
                        }
                    }
                }
            }

            bitmap.UnlockBits(data);

            if (ShowGrid)
            {
                using (var g = SGraphics.FromImage(bitmap))
                {
                    var rect = new Rectangle(0, 0, bitmap.Width, bitmap.Height);
                    ControlPaint.DrawGrid(g, rect, new Size(2, Game.CellSize), Color.DarkRed);
                    ControlPaint.DrawGrid(g, rect, new Size(Game.CellSize, 2), Color.DarkRed);
                    ControlPaint.DrawGrid(g, rect, new Size(Game.CellSize, Game.CellSize), Color.Red);
                }
            }

            return(bitmap);
        }
Esempio n. 21
0
 void pictureBox1_Paint(object sender, PaintEventArgs e)
 {
     ControlPaint.DrawGrid(e.Graphics, e.ClipRectangle, new Size(10, 10), Color.White);
 }
Esempio n. 22
0
 private void panel1_Paint(object sender, PaintEventArgs e)
 {
     base.OnPaint(e);
     ControlPaint.DrawGrid(e.Graphics, this.ClientRectangle, new Size(8, 8), Color.White);
 }
Esempio n. 23
0
        public const int ChunkSize = 8;                 // 8x8 chunks ==> 192x192 bitmaps.

        Bitmap RenderChunk(int u, int v)
        {
            var bitmap = new Bitmap(ChunkSize * TileSetRenderer.TileSize, ChunkSize * TileSetRenderer.TileSize);

            var data = bitmap.LockBits(bitmap.Bounds(),
                                       ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);

            unsafe
            {
                var p      = (int *)data.Scan0.ToPointer();
                var stride = data.Stride >> 2;

                for (var i = 0; i < ChunkSize; i++)
                {
                    for (var j = 0; j < ChunkSize; j++)
                    {
                        var ui   = u * ChunkSize + i;
                        var vj   = v * ChunkSize + j;
                        var uv   = new MPos(ui, vj);
                        var tr   = Map.MapTiles.Value[uv];
                        var tile = TileSetRenderer.Data(tr.Type);
                        if (tile == null)
                        {
                            continue;
                        }

                        var index    = (tr.Index < tile.Length) ? tr.Index : (byte)0;
                        var rawImage = tile[index];
                        for (var x = 0; x < TileSetRenderer.TileSize; x++)
                        {
                            for (var y = 0; y < TileSetRenderer.TileSize; y++)
                            {
                                p[(j * TileSetRenderer.TileSize + y) * stride + i * TileSetRenderer.TileSize + x] =
                                    Palette.GetColor(rawImage[x + TileSetRenderer.TileSize * y]).ToArgb();
                            }
                        }

                        if (Map.MapResources.Value[uv].Type != 0)
                        {
                            var resourceImage = ResourceTemplates[Map.MapResources.Value[uv].Type].Bitmap;
                            var srcdata       = resourceImage.LockBits(resourceImage.Bounds(),
                                                                       ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);

                            var q         = (int *)srcdata.Scan0.ToPointer();
                            var srcstride = srcdata.Stride >> 2;

                            for (var x = 0; x < TileSetRenderer.TileSize; x++)
                            {
                                for (var y = 0; y < TileSetRenderer.TileSize; y++)
                                {
                                    var c = q[y * srcstride + x];
                                    if ((c & 0xff000000) != 0)                                          /* quick & dirty, i cbf doing real alpha */
                                    {
                                        p[(j * TileSetRenderer.TileSize + y) * stride + i * TileSetRenderer.TileSize + x] = c;
                                    }
                                }
                            }

                            resourceImage.UnlockBits(srcdata);
                        }
                    }
                }
            }

            bitmap.UnlockBits(data);

            if (ShowGrid)
            {
                using (var g = SGraphics.FromImage(bitmap))
                {
                    var ts   = Game.ModData.Manifest.TileSize;
                    var rect = new Rectangle(0, 0, bitmap.Width, bitmap.Height);
                    ControlPaint.DrawGrid(g, rect, new Size(2, ts.Height), Color.DarkRed);
                    ControlPaint.DrawGrid(g, rect, new Size(ts.Width, 2), Color.DarkRed);
                    ControlPaint.DrawGrid(g, rect, new Size(ts.Width, ts.Height), Color.Red);
                }
            }

            return(bitmap);
        }