Results 1 to 4 of 4

Thread: question about printing

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2011
    Posts
    21

    question about printing

    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.
    Attached Images Attached Images  
    Last edited by dennis_ian; Dec 14th, 2011 at 06:48 PM.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: question about printing

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Nov 2011
    Posts
    21

    Re: question about printing

    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.(=

    Thank you so much jmcilhinney.(=

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: question about printing

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width