当前位置: 首页>>代码示例>>C#>>正文


C# Panel.CreateGraphics方法代码示例

本文整理汇总了C#中System.Windows.Forms.Panel.CreateGraphics方法的典型用法代码示例。如果您正苦于以下问题:C# Panel.CreateGraphics方法的具体用法?C# Panel.CreateGraphics怎么用?C# Panel.CreateGraphics使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.Panel的用法示例。


在下文中一共展示了Panel.CreateGraphics方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Drawer

 public Drawer(Panel panel, int _xGridSquareSize, int _yGridSquareSize)
 {
     g = panel.CreateGraphics();
     xGridSquareSize = _xGridSquareSize;
     yGridSquareSize = _yGridSquareSize;
     with = new DrawerUtensils();
 }
开发者ID:KirklandLandry,项目名称:3313-battleship,代码行数:7,代码来源:Drawer.cs

示例2: Draw

 public override void Draw(Panel panel)  // 畫出橢圓形
 {
     Pen myPen = new Pen(Color.Black, 1);
     Brush myBrush = new SolidBrush(Color.LightGray);
     StringFormat drawFormat = new StringFormat();  // 設定字形的位置
     drawFormat.Alignment = StringAlignment.Center;  // 水平置中
     drawFormat.LineAlignment = StringAlignment.Center;  // 垂直置中
     rect = new Rectangle(coordinate, size);
     panel.CreateGraphics().FillEllipse(myBrush, rect);
     panel.CreateGraphics().DrawEllipse(myPen, rect);
     panel.CreateGraphics().DrawString(myID, new Font("Arial", 16), new SolidBrush(Color.Black), rect, drawFormat);
     myPen.Dispose();
     myBrush.Dispose();
 }
开发者ID:pokk,项目名称:UML-OO,代码行数:14,代码来源:CaseClass.cs

示例3: DrawCross

 public void DrawCross(Panel panel)
 {
     Graphics g = panel.CreateGraphics();
     Pen _pen = new Pen(Color.Black, _linewidth);
     g.DrawLine(_pen, new Point(_innerMargin, _innerMargin), new Point(_square - _innerMargin, _square - _innerMargin));
     g.DrawLine(_pen, new Point(_innerMargin, _square - _innerMargin), new Point(_square - _innerMargin, _innerMargin));
 }
开发者ID:dreggjarnar,项目名称:Sidannaverkefni,代码行数:7,代码来源:DrawTicTacToe.cs

示例4: Draw

 public Draw(Panel panel1,Panel panel2)
 {
     width = panel2.Width;
     height = panel2.Height;
     formGraphics = panel1.CreateGraphics();
     formGraphics2 = panel2.CreateGraphics();
 }
开发者ID:Overload71,项目名称:MP_project,代码行数:7,代码来源:Draw.cs

示例5: PrintPanel

        public void PrintPanel(Panel p)
        {
            Graphics mygraphics = p.CreateGraphics();
            Size s = p.Size;
            mBitmap = new Bitmap(s.Width, s.Height, mygraphics);
            Graphics memoryGraphics = Graphics.FromImage(mBitmap);
            IntPtr dc1 = mygraphics.GetHdc();
            IntPtr dc2 = memoryGraphics.GetHdc();
            BitBlt(dc2, 0, 0, p.ClientRectangle.Width, p.ClientRectangle.Height, dc1, 0, 0, 13369376);
            mygraphics.ReleaseHdc(dc1);
            memoryGraphics.ReleaseHdc(dc2);

            saveFileDialog1.Filter = "图片文件(*.jpg)|*.jpg;";
            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    mBitmap.Save(saveFileDialog1.FileName, ImageFormat.Jpeg);
                }
                catch (Exception ee)
                {
                    MessageBox.Show(ee.Message, "Error");
                    return;
                }
                MessageBox.Show("保存成功!", "提示");
            }

        }
开发者ID:yangpeiren,项目名称:hello-world,代码行数:28,代码来源:Form2.cs

示例6: Vista

        public Vista(Panel areaDibujo)
        {
            g = areaDibujo.CreateGraphics();

                anchura = areaDibujo.Width;
                altura = areaDibujo.Height;
        }
开发者ID:Ang3lC3rvant3s,项目名称:Herecia-Class-Figuras-Animadas,代码行数:7,代码来源:Vista.cs

示例7: DrawRectangle

 public void DrawRectangle(Pen pen, Panel canvas)
 {
     Graphics g = canvas.CreateGraphics();
     g.DrawRectangle(pen, new Rectangle(X, Y, Width, Height));
     g.Dispose();
     pen.Dispose();
 }
开发者ID:svutborg,项目名称:Programming-II,代码行数:7,代码来源:Rect.cs

示例8: Vista

 public Vista(Panel areaDibujo)
 {
     this.g = areaDibujo.CreateGraphics();
     this.colorLapiz = Color.Empty;
     ancho = areaDibujo.Width;
     alto = areaDibujo.Height;
 }
开发者ID:vlasx,项目名称:Desarrollo_App_2,代码行数:7,代码来源:Vista.cs

示例9: Nodes

 public Nodes(Panel panel1,Panel panel2)
 {
     formGraphics = panel1.CreateGraphics();
     formGraphics.DrawRectangle(new Pen(Color.Blue, 5), panel1.ClientRectangle);
     formGraphics2 = panel2.CreateGraphics();
     formGraphics2.DrawRectangle(new Pen(Color.Blue, 5), panel2.ClientRectangle);
 }
开发者ID:Overload71,项目名称:minimumSpanning-tree,代码行数:7,代码来源:Nodes.cs

示例10: Draw

        public static void Draw( string text, int[] pixels)
        {
            var form = new Form { TopMost = true, Visible = true, Width = 29 * tileSize, Height = 29 * tileSize };

            var panel = new Panel { Dock = DockStyle.Fill };
            panel.BackColor = Color.Black;

            form.Controls.Add(panel);

            var graphics = panel.CreateGraphics();

            for(int index=0; index < pixels.Length; index++){
                int col = index % characerSize;
                int row = index / characerSize;
                Color color = Color.FromArgb(pixels[index], pixels[index], pixels[index]);
                var brush = new SolidBrush(color);
                graphics.FillRectangle(brush,col*tileSize,row*tileSize,tileSize,tileSize);
            }

            var point = new PointF(5, 5);
            var font = new Font(FontFamily.GenericSansSerif, 30 );
            graphics.DrawString(text, font, new SolidBrush(Color.Red), point);

            Application.EnableVisualStyles();
            Application.Run(form);
        }
开发者ID:relentless,项目名称:DigitRecogniserDojo,代码行数:26,代码来源:Visualiser.cs

示例11: Vista

 public Vista(Panel areaDibujo, Color c1)
 {
     g = areaDibujo.CreateGraphics();
     colorLapiz = c1;
     anchura = areaDibujo.Width;
     altura = areaDibujo.Height;
 }
开发者ID:vlasx,项目名称:Desarrollo_App_2,代码行数:7,代码来源:Vista.cs

示例12: DrawCross

 private void DrawCross(Panel panel)
 {
     Graphics g = panel.CreateGraphics();
     Pen _pen = new Pen(Color.Black, _linewidth);
     g.DrawLine(_pen, new Point(_margin1, _margin1), new Point(_square - _margin1, _square - _margin1));
     g.DrawLine(_pen, new Point(_margin1, _square - _margin1), new Point(_square - _margin1, _margin1));
 }
开发者ID:dabbisig,项目名称:Sidannaverkefni,代码行数:7,代码来源:TicTacToeView.cs

示例13: fill_pictureBox

 /// <summary>
 /// Заполняет область рисования указанным цветом
 /// </summary>
 /// <param name="pb">объект для рисования PictureBox, ссылочный</param>
 /// <param name="C">цвет для заливки</param>
 public static void fill_pictureBox(ref Panel pb, Color C)
 {
     using (Graphics G = pb.CreateGraphics())
     {
         G.Clear(C);
     }
 }
开发者ID:008agent,项目名称:labs_numerical_methods,代码行数:12,代码来源:Painter.cs

示例14: DrawMap

        /// <summary>
        /// 地图描边
        /// </summary>
        /// <param name="panel"></param>
        /// <param name="map"></param>
        public static void DrawMap(Panel panel, ModelMap map)
        {
            #region 勾画地图
            var g = panel.CreateGraphics();
            #region 画横线
            for (int ri = 0; ri <= map.Row; ri++)
            {
                g.DrawLine(new Pen(Color.Black), 0, ri * map.Box.Height, map.Column * map.Box.Width, ri * map.Box.Height);
            }

            #endregion
            #region 画竖线
            for (int ci = 0; ci <= map.Column; ci++)
            {
                g.DrawLine(new Pen(Color.Black), ci * map.Box.Width, 0, ci * map.Box.Height, map.Row * map.Box.Width);
            }
            #endregion
            #region 勾画方块
            foreach (var b in map.Body)
            {
                DrawMapBox(panel, map.Color, b.Abscissa, b.Ordinate, map.Box.Width, map.Box.Height);
            }
            #endregion
            #endregion
        }
开发者ID:puhome,项目名称:imStudio.Game,代码行数:30,代码来源:MapHelper.cs

示例15: Vista

 public Vista(Panel areaDibujo, Color cl, Color cf)
 {
     g = areaDibujo.CreateGraphics();
     ColorLapiz = cl;
     ColorFondo = cf;
     anchura = areaDibujo.Width;
     altura = areaDibujo.Height;
 }
开发者ID:UlisesLopez,项目名称:Figuras,代码行数:8,代码来源:Vista.cs


注:本文中的System.Windows.Forms.Panel.CreateGraphics方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。