views:

63

answers:

1

How to quickly create some random image with the icon size? I don't want to use neither Image.FromFile, nor Image.FromStream

+3  A: 
int width = 50;
int height = 50;
using (Bitmap bitmap = new Bitmap(width, height))
{

    // do something to the bitmap
    // perhaps use .SetPixel to maybe apply some color

    bitmap.Save("C:\\Temp\\random.bmp");
}
Anthony Pegram
+1 `Graphics.FromImage` will be helpful also.
Daniel Earwicker
Its useful to declare Graphics object? which has more functions to edit picture. Graphics gr = Graphics.FromImage(bitmap);http://msdn.microsoft.com/en-us/library/system.drawing.graphics_members%28v=VS.71%29.aspx
Stremlenye