CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Help in VB reqd

  1. #1
    Join Date
    Aug 2001
    Posts
    10

    Help in VB reqd

    We are porting an existing application From C to VB.

    In the dos system it prints some reports using font 8 'ROMAN'.The font is set using the statement
    fprintf(fp1,"%c(8U\r",escape) while fp1 is declared as a file pointer.

    But we are not able to find that font in VB (where we are using print
    method of richtext box for printing).
    The closest font( to roman) in VB is 'Times New Roman' but that is
    not a true font so we will have indentation problems in using that.Is it possible to align the text in any font in RichText box?

    Please give us the list of "True Fonts" that are available in VB.

    Any pointers to printing in VB are welcome.

    Thanks,
    -arun


  2. #2
    Join Date
    Jun 2001
    Location
    Memphis, TN
    Posts
    146

    Re: Help in VB reqd

    Hi, I can't give you a complete answer to your trouble but maybe a suggestion- if the reason you are wanting this app to print font-specific is because the text alignment is wrong, maybe you could try one of the courier fonts where all letters take up the same horizontal width. I hope that idea helps- good luck!

    Jeff


  3. #3
    Join Date
    Apr 2000
    Location
    South Carolina,USA
    Posts
    2,210

    Re: Help in VB reqd

    VB uses the Fonts available on the system. "Roman" is not a font normally available, at least not on any system I am used to. (win 95, 98, 98SE or ME) English versions.
    Below is a small program that will interrogate your default printer and display fonts available along with a sample of the individual fonts
    Start a new project. Add a text box in the upper left corner. Below it add a listBox. To the right add a large Picturebox.
    The textbox is used to choose the Font Size. The ListBox displays the available fonts. The picturebox displays a sample of the font you click on in the listbox.
    '
    If your problem is character/column alignment on the printed page, then use a non-proportional font such as "Courier" or "Symbol" where all characters are the same width. "Times New Roman" is a proportional font in that the character width is variable thus producing column alignment difficult.

    option Explicit

    private Sub Form_Load()
    Dim I as Integer
    Picture1.Visible = false
    'This example prints a list of the printer fonts in a ListBox control. to try this example, paste the code into the Declarations section of a form that has a ListBox control named List1, and then press F5 and click the form.()
    Form1.Show
    Text1.Text = 36
    Text1.SetFocus
    for I = 0 to Printer.FontCount - 1 ' Determine number of fonts.
    List1.AddItem Printer.Fonts(I) ' Put each font into list box.
    next I

    End Sub


    private Sub List1_Click()
    Picture1.Visible = true
    Picture1.FontSize = Text1.Text
    Picture1.FontName = List1.List(List1.ListIndex)
    Picture1.Cls
    Picture1.print "abcdefghijklm"
    Picture1.print "nopqrstuvwxyz"
    Picture1.print UCase("abcdefghijklm")
    Picture1.print UCase("nopqrstuvwxyz ")
    Picture1.print "0123456789"
    Picture1.print "+-={}[]:" '<>,."
    Picture1.print "?/|\(!@#$%^&*()_"
    End Sub


    private Sub Text1_Click()
    ' Code to highlight current text and delete entire string on key entry
    ' text1 is name of text box control

    Text1.SelStart = 0
    Text1.SelLength = len(Text1.Text)

    End Sub




    John G

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

Featured