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


C# PictureBox.CreateGraphics方法代码示例

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


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

示例1: Render

        private processOnRender _RenderMiniSnakeDel; // Delegate for RenderMiniSnake method.

        #endregion Fields

        #region Constructors

        public Render(PictureBox gameBoardPictureBox, PictureBox miniGameBoardPictureBox)
        {
            _RenderMiniSnakeDel = new processOnRender(RenderMiniSnake);    ////
            _RenderFruitDel = new processOnRender2(RenderFruit);           //
            _RenderMiniFruitDel = new processOnRender2(RenderMiniFruit);   // Initialiaze delegates.
            _RenderInsectDel = new processOnRender3(RenderInsect);         //
            _RenderMiniInsectDel = new processOnRender3(RenderMiniInsect); //

            _MyGraphics = gameBoardPictureBox.CreateGraphics();         // Initialize the graphics object for the gameboard.
            _MyMiniGraphics = miniGameBoardPictureBox.CreateGraphics(); // Initialize the graphics object for the mini gameboard.
            _MyBrush = new System.Drawing.SolidBrush(Color.Black);      // Initialize the first brush.
            _MyBrush2 = new System.Drawing.SolidBrush(Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))))); // Initialize the 2nd brush.
            _Pen = new Pen(Color.Black, 2); // Initialize pen.

            _MiniSnakeGraphicalParts = new List<PictureBox>(); // New list of picturebox (for mini snake).

            _Fruit = new PictureBox();                       // New PictureBox.
            _Fruit.Size = new System.Drawing.Size(12,12);    // Definition of the picturebox size.
            _Fruit.Image = Snake.Properties.Resources.Fruit; // Initialize the fruit image.

            _MiniFruit = new PictureBox();                           // New PictureBox.
            _MiniFruit.Size = new System.Drawing.Size(6, 6);         // Definition of the picturebox size.
            _MiniFruit.Image = Snake.Properties.Resources.MiniFruit; // Initialize the mini fruit image.

            _Insect = new PictureBox();                        // New PictureBox.
            _Insect.Size = new System.Drawing.Size(26,26);     // Definition of the picturebox size.
            _Insect.Image = Snake.Properties.Resources.Insect; // Initialize the insect image.

            _MiniInsect =  new PictureBox();                           // New PictureBox.
            _MiniInsect.Size = new System.Drawing.Size(13,13);         // Definition of the picturebox size.
            _MiniInsect.Image = Snake.Properties.Resources.MiniInsect; // Initialize the mini insect image.
        }
开发者ID:Genjo15,项目名称:Snake,代码行数:38,代码来源:Render.cs

示例2: Draw

        public void Draw(PictureBox _bmp)
        {
            Graphics graph = _bmp.CreateGraphics();
            graph.Clear(Color.White);

            Parallel.ForEach(Particles, _particle => _particle.Draw());
        }
开发者ID:xnastia,项目名称:ConsoleAMPVicsek,代码行数:7,代码来源:ParticleBox.cs

示例3: clearCanvas

 /// <summary>
 /// Очищает область для рисования
 /// </summary>
 /// <param name="pbCanvas">ссылка на объект PictureBox для рисования</param>
 /// <param name="foreColor">цвет фона</param>
 public static void clearCanvas(ref PictureBox pbCanvas,Color foreColor)
 {
     using (Graphics G = pbCanvas.CreateGraphics())
     {
         G.Clear(foreColor);
     }
 }
开发者ID:008agent,项目名称:prog_tech,代码行数:12,代码来源:Painter.cs

示例4: drawDiagramm

        /// <summary>
        /// Рисует столбиковую диаграмму
        /// </summary>
        /// <param name="pbCanvas">Ccылка на объект PictoreBox для рисования</param>
        /// <param name="IC">Объект InitialCondition, задающий начальные условия</param>
        public static void drawDiagramm(ref PictureBox pbCanvas, utils.InitialConditions IC)
        {
            Color GlaphColor = Color.FromArgb(Globals.glob_colorRed, Globals.glob_colorGreen, Globals.glob_colorBlue);
            Point[] arr = new Point[IC.ctx.Xarr.GetLength(0)];
            Point[] zeroVertexes = new Point[IC.ctx.Xarr.GetLength(0)];

            Point pCenter = new Point();
            pCenter.X = (int)((pbCanvas.Width / (Math.Abs(IC.Xmin) + Math.Abs(IC.Xmax))) * Math.Abs(IC.Xmin));
            pCenter.Y = (int)((pbCanvas.Height / (Math.Abs(IC.Ymin) + Math.Abs(IC.Ymax))) * Math.Abs(IC.Ymax));
            for (int i = 0; i < IC.ctx.Xarr.GetLength(0); i++)
            {
                arr[i].X = (int)(pCenter.X + 2 * (IC.ctx.Xarr[i] * IC.scaleX));
                zeroVertexes[i].X = arr[i].X;
            }
            for (int j = 0; j < IC.ctx.Yarr.GetLength(0); j++)
            {
                arr[j].Y = (int)(pCenter.Y - 2 * (IC.ctx.Yarr[j] * IC.scaleY));
                zeroVertexes[j].Y = pCenter.Y;
            }
            using (Graphics G = pbCanvas.CreateGraphics())
            {
                using (Pen p = new Pen(GlaphColor))
                {
                    p.Width = 3;
                    for (int i = 0; i < zeroVertexes.GetLength(0); i++)
                    {
                        G.DrawLine(p, arr[i], zeroVertexes[i]);
                    }
                }
            }
        }
开发者ID:008agent,项目名称:prog_tech,代码行数:36,代码来源:Painter.cs

示例5: _Tool

 public _Tool(PictureBox p, Bitmap bm)
 {
     image = bm;
     Pic = p;
     Graph = Graphics.FromImage(bm);
     TempGraph = p.CreateGraphics();
     p.Image = bm;
 }
开发者ID:Namey,项目名称:Paint,代码行数:8,代码来源:Tool.cs

示例6: DrawShape

 public override PictureBox DrawShape(PictureBox pic, Point point)
 {
     Graphics g = Graphics.FromImage(pic.Image);
     g = pic.CreateGraphics();
     g.DrawLine(myPen, firstLocation,point);
     pic.Image = pic.Image;
     return pic;
 }
开发者ID:amal-roshan,项目名称:PaintApplication,代码行数:8,代码来源:Line.cs

示例7: drawNode

 public void drawNode(PictureBox panel)
 {
     SolidBrush brush = new SolidBrush(colorNode);
     Graphics graphics = panel.CreateGraphics();
     graphics.FillEllipse(brush, location.X, location.Y, size, size);
     label.Location = new Point((int)(location.X + 3),(int)(location.Y + 3));
     panel.Controls.Add(label);
     label.Refresh();
 }
开发者ID:kastrulya,项目名称:v2,代码行数:9,代码来源:Node.cs

示例8: MyMap

 public MyMap(PictureBox p, FormMapCopy formMap)
 {
     this.formMap = formMap;
     pictureBox = p;
     g = p.CreateGraphics();
     pictureBox.MouseDown += pictureBox_MouseDown;
     pictureBox.MouseMove += pictureBox_MouseMove;
     pictureBox.Paint += pictureBox_Paint;
     pictureBox.Resize += pictureBox_Resize;
 }
开发者ID:alexisjojo,项目名称:tibiasmartcombo,代码行数:10,代码来源:MyMap.cs

示例9: Hand

 /// <summary>
 /// 新建一个时钟上的指针对象
 /// </summary>
 /// <param name="widthOfPen">指针宽度</param>
 /// <param name="length">指针长度</param>
 /// <param name="startPoint">指针中心点</param>
 /// <param name="startAngle">起始位置与12点钟方向的夹角(单位为弧度)</param>
 /// <param name="box">指针所在的容器</param>
 /// 创建人:卢君默    创建时间:2015-7-24 21:00:23
 public Hand(int widthOfPen, int length, Point startPoint, float startAngle, PictureBox box)
 {
     pen = new Pen(Color.Black, widthOfPen);
     this.length = length;
     this.startAngle = startAngle;
     this.startPoint = startPoint;
     //这里先不指定端点的位置,每次划线的时候再计算点的位置
     endPoint = new Point();
     this.g = box.CreateGraphics();
 }
开发者ID:ljm1992,项目名称:lujmClockControl,代码行数:19,代码来源:Hand.cs

示例10: DrawShape

 public override PictureBox DrawShape(PictureBox pic, Point point)
 {
     System.Drawing.Rectangle rect = new System.Drawing.Rectangle(Math.Min(point.X, firstLocation.X), Math.Min(point.Y, firstLocation.Y), Math.Abs(point.X - firstLocation.X), Math.Abs(point.X - firstLocation.X));
     Graphics g = Graphics.FromImage(pic.Image);
     //g.DrawRectangle(myPen, firstLocation.X,firstLocation.Y, Math.Abs(point.X - firstLocation.X),Math.Abs(point.Y - firstLocation.Y));
     g = pic.CreateGraphics();
     g.DrawRectangle(myPen, rect);
     pic.Image = pic.Image;
     return pic;
 }
开发者ID:amal-roshan,项目名称:PaintApplication,代码行数:10,代码来源:SquareShape.cs

示例11: Form1

        public Form1()
        {
            pictureBox1 = new PictureBox {Width = 500, Height = 500};
            bmp = new Bitmap(pictureBox1.Width, pictureBox1.Height);

            Graphics graphics = Graphics.FromImage(bmp);
            ariaG = pictureBox1.CreateGraphics();
            graphics.Clear(Color.White);
            InitializeComponent();
            pictureBox1.Image = bmp;
        }
开发者ID:sid365365,项目名称:Art,代码行数:11,代码来源:Form1.cs

示例12: Create

 public void Create()
 {
     Map = new PictureBox();
     Map.Width = 400 ;
     Map.Height = 400;
     Map.Location = new System.Drawing.Point(350, 13);
     Map.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
     pen = new Pen(Color.Red);
     pen2 = new Pen(Color.Green);
     image1 = Map.CreateGraphics();
 }
开发者ID:qwertyV112,项目名称:Rascroi,代码行数:11,代码来源:Image.cs

示例13: getDPI

 private static int getDPI()
 { 
     int currentDPI = 0;
     using (PictureBox pic = new PictureBox())
     {
         using (Graphics g =  pic.CreateGraphics())
         {
             currentDPI = (int)g.DpiX;
         }
     }
     return currentDPI;
 }
开发者ID:javiercrowsoft,项目名称:CSReports.net,代码行数:12,代码来源:cUtil.cs

示例14: Draw

 public void Draw(PictureBox pb)
 {
     Graphics graphics = pb.CreateGraphics();
     graphics.Clear(pb.BackColor);
     for (int i = 0; i < 8; i++)
         for (int j = 0; j < 8; j++)
             if (data[i, j])
             {
                 graphics.FillRectangle(
                     new SolidBrush(Color.Black),
                     new Rectangle(j * 8, i * 8, 8, 8));
             }
 }
开发者ID:sasha2567,项目名称:7-semestr,代码行数:13,代码来源:Img8x8.cs

示例15: DrawerStandart

        public DrawerStandart(PictureBox _pBox)
        {
            pBox = _pBox;

            SizeX = pBox.Width;
            SizeY = pBox.Height;

            Graph = pBox.CreateGraphics();

            PenBlack = new Pen(Color.Black, 2);
            PenBlue = new Pen(Color.Blue, 2);

            BrushWhite = new SolidBrush(Color.White);
        }
开发者ID:xnastia,项目名称:ConsoleAMPVicsek,代码行数:14,代码来源:DrawerStandart.cs


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