hi just finished my first project and it was quite a journey (hahaha, considering its my first time to do it. Just wanna ask, with this code:.....
Code:
Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintiTicket.PrintPage
e.Graphics.DrawString("COUNTER 17.Your number is " & iTicket, TextBox1.Font, Brushes.Blue, 50, 50)
End Sub
.... i was able to print the text that i want, but is it possible that it be printed in three lines? i mean on the first line, the text "Counter 17", and in the second line with a smaller font size, "Your number is" and on the third line with a bigger font size the "& iticket portion"?
ive read lots of tutorial but i guess, i just cant find the one that tackles this one. Thank you so much in advance.
Last edited by dennis_ian; Dec 14th, 2011 at 06:48 PM.
Think about what you're doing. You are already calling DrawString and you are telling it what to print and where. If you want to print three lines then does it not follow that you would simply call DrawString three times with different text and a different location each time? If you were going to use just one Font then you could call DrawString once and simply include the line breaks in the String, just like in a Label or TextBox. Just like a Label or TextBox though, all the text passed to DrawString is formatted the same way. If you want multiple formats then you need multiple calls.
thanks jmcilhinney, actually i did your suggestion even before i posted this question. But the thing is, as i was reading forums and stuff about vb, i remember one saying that there are other possible and simple codes you can use in creating your db. I might have written my question wrong. It should had been "shorter or simple code i could use in creating a three line printed text". I guess there are none.(=
No, not really. Like I said, if the text was all to be formatted the same way then you could simply draw one String containing line breaks but each DrawString call can only use a single format. As you need at least two formats, probably three by the looks, you will need at two or three calls.