Results 1 to 4 of 4

Thread: Printing simple

  1. #1

    Thread Starter
    Stack Overflow mod​erator
    Join Date
    May 2008
    Location
    British Columbia, Canada
    Posts
    2,824

    Unhappy Printing simple

    Is there a way to print simple text in Courier New? No pictures, no fancy fonts, it's all the same size, and no margins, etc. Is there a VB.NET function for this?

  2. #2
    Frenzied Member
    Join Date
    Jun 2005
    Posts
    1,950

    Re: Printing simple

    What do you want to print from?, a RichTextBox? There's a complete example here of printing here;

    http://www.vbdotnetheaven.com/Upload...nginVBNET.aspx

    You can print in any font supported under "System.Drawing". So if Courier New is there you can print with it.

    You can see available fonts using
    Code:
            Dim MyFonts As System.Drawing.Text.InstalledFontCollection = New _
            System.Drawing.Text.InstalledFontCollection
            Dim Str As String = String.Empty
            For Each fam As FontFamily In MyFonts.Families
                Str += fam.Name & " "
            Next
            MessageBox.Show(Str)
    Last edited by Bulldog; Mar 27th, 2009 at 02:17 PM.

  3. #3
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,413

    Re: Printing simple

    you need to add a printdocument to your project.
    in the printdocument_printpage event you use drawstring, in which you can specify your font.

    try that + if you need any more help ask again

  4. #4

    Thread Starter
    Stack Overflow mod​erator
    Join Date
    May 2008
    Location
    British Columbia, Canada
    Posts
    2,824

    Re: Printing simple

    Quote Originally Posted by Bulldog View Post
    What do you want to print from?, a RichTextBox? There's a complete example here of printing here;

    http://www.vbdotnetheaven.com/Upload...nginVBNET.aspx

    You can print in any font supported under "System.Drawing". So if Courier New is there you can print with it.

    You can see available fonts using
    Code:
            Dim MyFonts As System.Drawing.Text.InstalledFontCollection = New _
            System.Drawing.Text.InstalledFontCollection
            Dim Str As String = String.Empty
            For Each fam As FontFamily In MyFonts.Families
                Str += fam.Name & " "
            Next
            MessageBox.Show(Str)
    I want to print out simple text in one font. That means no RichTextBoxes.

    Thanks, .paul.. I'll try that now.

Tags for this Thread

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