Question Draw the squares on exam paper

tecnauta

New member
Joined
Apr 15, 2013
Messages
2
Programming Experience
1-3
Good day to all.

I have little experience with C#, and my boss asked me to make a program that will get some serial number from a DB, and print it as squares, in the right position, in a paper. Much like this image (http://i49.tinypic.com/v7gok9.jpg).
Well, I can get the numbers, but I have no idea of how to make such print. Does anyone have a idea of what I?m talking about, and can point me to the right direction of what I need to study?

Thanks.

Edit: I need only to draw the squares in black... the paper, with the rest of the text, and the locations of the squares, are already printed.
 
.NET printing is based around the PrintDocument class. In the most basic case, you create a PrintDocument (which you can add to a form in the designer), call its Print method and then handle its PrintPage event. In the PrintPage event handler, you use the Graphics object provided to draw your printed output using GDI+, just as you would draw on a control in its Paint event handler. In your case, you'd want to call the FillRectangle method of the Graphics object.

I would suggest that you start by doing a bit of reading on GDI+, the Graphics class and its FillRectangle method. You can test by simply drawing on a form. Once you're comfortable with that part, do some reading on .NET printing, the PrintDocument class and its PrintPage event. You can then basically transfer your existing GDI+ code into the PrintPage event handler of the PrintDocument.
 
Back
Top Bottom