printing query

jnash

Well-known member
Joined
Oct 20, 2006
Messages
111
Programming Experience
Beginner
my application has to generate a membership card, i have a picturebox as a background, varible data in testboxes, now how do i get that who group to print as one?

thanks
 
If you're using the PrintDocument all work is done in PrintPage event handler that provide the Graphics instance used to draw, with this you use its methods to draw shapes, text and images. (DrawRectangle, DrawString, DrawImage for example). It would be possible to capture the form/panel as an image to draw to print directly, but that would be very uncommon for the job you're describing where most usual you would be print loads of membership cards in one go. Another alternative is the reporting services for databases or Crystal Reports.
 
that kinda went straight over my head,

no i would only like one generated at that point, the information is dropped into the texboxes that are laying on top of a image which i want to be the card

any other advice, or a more detailed information, is there no way to produce a print screen idea as that would be easy!
thanks in advance
 
Thank you very much for that, its excellent however its not extremely clear, i have a barcode on it also in the text box and its no 100 percent clear.
However i am using a crappy old printer, but the printer is capable of printing out barcodes perfectly

thanks
 
The snapshot bitmap is very clear from what I see, you can review this in a picturebox, but drawing that image into print may get a little blurry. Experiment with the different quality settings of the printing Graphics instance. Examples:
VB.NET:
e.Graphics.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic
e.Graphics.PixelOffsetMode = Drawing2D.PixelOffsetMode.HighQuality
e.Graphics.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
e.Graphics.CompositingQuality = Drawing2D.CompositingQuality.HighQuality
e.Graphics.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAliasGridFit
For different sources you perhaps want to experiment with graphics quality setting also on the creation of snapshot, but I didn't see any difference with my tests.
 
before i play with this ill test it on the printer that is being used to see if the text (which is a barcode font) is legible enough im sure it will be okay on a better quality printer

thank you very much for your response

Jon
 
ive tried these but the quality of the barcode in the textbox isnt sharp enough for the reader to read, is there anyway i could include the text box over the panel and print that also if i specify some sort of localtion where to print it!

thanks
 
You've already seen example of the graphics.DrawImage method used in PrintPage event handler, the other Draw/Fill methods aren't any different, try the FillRectangle and DrawString and you have basically drawn a textbox directly to page. All these methods require you to specify the rectangle or location where to draw.
 
Back
Top