I'm working in C# .NET 3.5. I have a class of recipes that contains an image and some strings. I want to print out these recipes, four per page. I want to write a "getprintobject" function in the class to return something to draw onto my print document, but I'm stumped...
I wish I could just create and return a graphics object, but I don't see a "e.graphics.drawgraphics()". I hav开发者_StackOverflowe also thought about creating a bitmap or image and returning that, but I'm not sure how to create one from scratch and get a new graphics object to modify it.
Create an Image, and use that image as a base for your Graphics object. e.g.
Bitmap img = new Bitmap(50, 50);
Graphics g = Graphics.FromImage(img);
Drawing on your graphics object, will draw on your image -- which you can then return.
精彩评论