Rick Doll

Rick Doll

  • NA
  • 47
  • 0

Printing multiple textboxes, same print doc.

Jun 26 2007 1:02 PM
 

Printing multiple textboxes from the form.

 

I want to print textboxes that stand next to eachother. one to the left, one to the right, each filling half the page, and also one directly under them.

 

I cant seem to get the text boes to shift in the alignment though like I can in my output display page. In that the windows form displays them properly but on print it just shoves them on the same lines.

 

Is there a way to manage it so textboxes print in the same location they are in the form?


Here is my print code. Bare with me I am a very early programmer and this project is actually the first I have ever printed from :)


private void printDocument2_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)

{

Graphics g = e.Graphics;

Graphics g2 = e.Graphics;

textBox1.Text = "Closers: " + Closers +

"\r\n" +

"\r\n" +

"In Hundreds you have " + string.Format("{0:C}{1}", tHundreds, ".") +

"\r\nIn Fifties you have " + string.Format("{0:C}{1}", tFifties, ".") +

"\r\nIn Twenties you have " + string.Format("{0:C}{1}", tTwenties, ".") +

"\r\nIn Tens you have " + string.Format("{0:C}{1}", tTens, ".") +

"\r\nIn Fives you have " + string.Format("{0:C}{1}", tFives, ".") +

"\r\nIn Twos you have " + string.Format("{0:C}{1}", tTwos, ".") +

"\r\nIn Ones you have " + string.Format("{0:C}{1}", tOnes, ".") +

"\r\n" +

"\r\n" +

"\r\nYour total in bills is " + string.Format("{0:C}{1}", tBillTotal, ".") +

"\r\n" +

"\r\n" +

"\r\nIn Wrapped you have " + string.Format("{0:C}{1}", tWrapped, ".") +

"\r\nIn Gold/Silver Dollars you have " + string.Format("{0:C}{1}", tDollars, ".") +

"\r\nIn Half Dollars you have " + string.Format("{0:C}{1}", tHalfDollar, ".") +

"\r\nIn Quarters you have " + string.Format("{0:C}{1}", tQuarters, ".") +

"\r\nIn Dimes you have " + string.Format("{0:C}{1}", tDimes, ".") +

"\r\nIn Nickels you have " + string.Format("{0:C}{1}", tNickels, ".") +

"\r\nIn Pennies you have " + string.Format("{0:C}{1}", tPennies, ".") +

"\r\n" +

"\r\n" +

"\r\nYour total in change is " + string.Format("{0:C}{1}", tChangeTotal, ".") +

"\r\n" +

"\r\n" +

"\r\nYour total currency is " + string.Format("{0:C}{1}", tTotalCurrency, ".") +

"\r\n" +

"\r\n" +

"\r\nThe deposit is " + string.Format("{0:C}{1}", tDeposit, ".");

textBox2.Text = DateTime.Now.ToLongDateString() +

"\r\n" +

"\r\n" +

"In Hundreds you have " + string.Format("{0:C}{1}", tHundreds2, ".") +

"\r\nIn Fifties you have " + string.Format("{0:C}{1}", tFifties2, ".") +

"\r\nIn Twenties you have " + string.Format("{0:C}{1}", tTwenties2, ".") +

"\r\nIn Tens you have " + string.Format("{0:C}{1}", tTens2, ".") +

"\r\nIn Fives you have " + string.Format("{0:C}{1}", tFives2, ".") +

"\r\nIn Twos you have " + string.Format("{0:C}{1}", tTwos2, ".") +

"\r\nIn Ones you have " + string.Format("{0:C}{1}", tOnes2, ".") +

"\r\n" +

"\r\n" +

"\r\nYour total in bills is " + string.Format("{0:C}{1}", tBillTotal2, ".") +

"\r\n" +

"\r\n" +

"\r\nIn Wrapped you have " + string.Format("{0:C}{1}", tWrapped2, ".") +

"\r\nIn Gold/Silver Dollars you have " + string.Format("{0:C}{1}", tDollars2, ".") +

"\r\nIn Half Dollars you have " + string.Format("{0:C}{1}", tHalfDollar2, ".") +

"\r\nIn Quarters you have " + string.Format("{0:C}{1}", tQuarters2, ".") +

"\r\nIn Dimes you have " + string.Format("{0:C}{1}", tDimes2, ".") +

"\r\nIn Nickels you have " + string.Format("{0:C}{1}", tNickels2, ".") +

"\r\nIn Pennies you have " + string.Format("{0:C}{1}", tPennies2, ".") +

"\r\n" +

"\r\n" +

"\r\nYour total in change is " + string.Format("{0:C}{1}", tChangeTotal2, ".") +

"\r\n" +

"\r\n" +

"\r\nYour total currency is " + string.Format("{0:C}{1}", tTotalCurrency2, ".") +

"\r\n" +

"\r\n" +

"\r\nThe deposit is " + string.Format("{0:C}{1}", tDeposit2, ".");

Font messageFont = new Font("Arial Black", 12, System.Drawing.GraphicsUnit.Point);

g.DrawString(textBox1.Text, messageFont, Brushes.Black, 25, 25);

g2.DrawString(textBox2.Text, messageFont, Brushes.Black, 25, 25);

}//closes method.



It prints just fine it just prints them in the same spot on the page.


Answers (3)