Shaitan00 Posted July 14, 2006 Posted July 14, 2006 Given the following code: Bitmap img = new Bitmap(nLevelWidth, nLevelHeight); Graphics gLevel = Graphics.FromImage(img); Bitmap imgBelow = _imgIcon; imgBelow.MakeTransparent(); gLevel.DrawImage(imgBelow, i, j, SIZE, CELL_SIZE); // NOW I NEED TO SET THE BACKCOLOR OF THE GRAPHICS BEFORE I PUT IT ON THE SCREEN So, I create a new Image (img) and load its Graphics (gLevel) so I can draw on it, then I draw an Icon somewhere on it (can be anywhere, and can be any kind of Icon)... After that is done I need to give my Image (img) a BACKCOLOR / BACKGROUND and oddly enough I can't seem to figure out how to set that property... Any ideas, hints, and help would be greatly appreciated, thanks Quote
Cags Posted July 14, 2006 Posted July 14, 2006 As far as I'm aware there is no simple way to change the background in the manner you describe, because quite simply there is no such thing as a background. To the best of my knowledge the bitmap object is single layer meaning that it has no way of distinguishing a difference between what you think is the background and the image. One way of doing this would be to research some of the various flood fill options, but that could potentially become complicated. The simplest approach would be to set the background colour before drawing the imagine by calling gLevel.Clear(backCol); Quote Anybody looking for a graduate programmer (Midlands, England)?
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.