|
-
Oct 9th, 2006, 01:51 PM
#1
Thread Starter
PowerPoster
printing [solved]
I'm never good in the printing/graphics area so I hope you can help me.
I can make text print, thats cool but what I am not good at is how to make it print the contents of the form (for each control in form...print text) to the page. Now, what I need for it is to align them and make them print in order, example going from top left to bottom right...line by line...
so it wouldnt matter where I place the controls on the form, I just want their textual value to be printed next to the previous textual value, and if the line is almost at the edge of the paper, to move to the next line and continue printing.
how can this be done?
Last edited by Techno; Oct 10th, 2006 at 06:48 PM.
-
Oct 9th, 2006, 02:46 PM
#2
Re: printing
Code:
foreach(Control cc in this.Controls)
myText+=cc.Text + "\r\n";
?
I don't live here any more.
-
Oct 9th, 2006, 03:24 PM
#3
Thread Starter
PowerPoster
Re: printing
nope. lol
I want to print the contents (text) of the current control (cc in your example) to the document in a way that it will keep printing line by line, but it will move to the NEXT line once it reaches the end of that line
-
Oct 9th, 2006, 05:57 PM
#4
Re: printing
You need to measure the text you're about to print using the MeasureString method and compare that to the amount of available width left on the page. You know that width because you know where the right edge of the last string you drew is. If there is not enough room left on the current line you set the X coordinate back to zero and increase the Y coordinate so that the text gets drawn to the far left and below the previous. This appears to be the next line to the reader, but of course we know that there are no actual lines in .NET printing. Just the coordinates that you specify.
-
Oct 10th, 2006, 06:48 PM
#5
Thread Starter
PowerPoster
Re: printing
yes I found that out after a few minutes of my last post, thanks very much! good to know that I'm doing it correctly
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|