Changes

Jump to: navigation, search

Using Bitmaps for Persistent Graphics in C Sharp

809 bytes added, 20:01, 29 January 2008
Rendering a Bitmap Image on a C# Control
[[Image:c_sharp_bitmap_image.jpg|Graphics Rendered using a Bitmap]]
 
== Changing the background Color a Bitmap ==
 
If you followed the tutorial you will now have a plum color circle drawn on a black background. The background is black because this the default for a new Bitmap object and we made not attempt change the color after we created the Graphics Object. Had we wanted a different background color we could have called the ''Clear()'' method of the graphics object, passing in a new color:
 
<pre>
myBitmap = new Bitmap(this.ClientRectangle.Width, this.ClientRectangle.Height,
System.Drawing.Imaging.PixelFormat.Format24bppRgb);
 
graphicsObj = Graphics.FromImage(myBitmap);
 
graphicsObj.Clear(System.Drawing.Color.White);
</pre>
 
The above code will clear the bitmap and change the color of the background to white.

Navigation menu