Click here to Skip to main content
12,951,983 members (57,916 online)
Rate this:
Please Sign up or sign in to vote.

i need to print groupbox with its content on full page... (its basically a bill).

can someone please guide me..

i have written the code but the PrintPreview shows only half image...

here is the code..
private void prnt_preview_btn_Click(object sender, EventArgs e)
          PrintPreviewDialog ppd = new PrintPreviewDialog();
          PrintDocument pd = new PrintDocument();
          pd.PrintPage += new PrintPageEventHandler(print);
          ppd.Document = pd;


 void print(object sender, PrintPageEventArgs e)
          int width = 1000;
          int height = 1800;
          Bitmap bmp = new Bitmap(width, height);
          Rectangle rec = new Rectangle(0, 0, bill_groupbox.Width,height);
          bill_groupbox.DrawToBitmap(bmp, rec);


i have not done any printing related codeing earlier.. hence,i don't have much experience...
could someone please help me with this...

Thanks in Advance... :)
Posted 28-Feb-13 3:52am
Updated 28-Feb-13 4:07am
Joezer BH38.9K

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 6,239
CHill60 3,490
Maciej Los 3,083
Jochen Arndt 1,975
ppolymorphe 1,880

Advertise | Privacy | Mobile
Web02 | 2.8.170525.1 | Last Updated 28 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100