Drawing: drawImage a usage

Browse the code and test the usage, only for personal learning record

private void drawImage()

{

           Bitmap bp = new Bitmap (40,40) ; // 40 * 40 defines a rectangular area drawing area
            Graphics Graphics.FromImage G = (BP);   
            g.DrawRectangle (new new Pen (Color.Red,. 1), 0, 0, bp.Width, bp.Height); // TuCheng red border drawing area, to facilitate the observation
            g.DrawLine (new Pen (Color.Green, 3 ), 0, 0, 40, 40); // draw a diagonal line
            // g.drawLine (new new Pen (Color.green,. 3), 40, 0, 0, 40);
            g.Dispose (); // release G
            this.BackgroundImage = BP; displayed as the background color of the form // bp, display form mode is started from the upper left divided into a plurality of rectangular regions 40 * 40, each region displays BP, so that the background will have the form

                                                            Several small cubes forming, where concrete is useful to be determined

 

}

To form only a background bp, the bp = new Bitmap (Width, Height), the size of the display area is set to be

Guess you like

Origin www.cnblogs.com/20191204C/p/12143412.html