Results 1 to 10 of 10

Thread: printing RichTextBoxes

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2000
    Location
    Cairns,North Queensland, Australia
    Posts
    21
    I have two RichTextBoxes and when I print out their text
    it prints each one on a separate page,how do I get it to print on the same page. Thanks in advance for any help.
    Also the currentX and currentY don't seem to work.

    [Edited by AndyB on 07-13-2000 at 07:39 PM]

  2. #2
    Guest
    Wouldn't it just be:

    Code:
    Printer.Print Richtextbox1.text & Richtextbox2.text

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Mar 2000
    Location
    Cairns,North Queensland, Australia
    Posts
    21
    Thanks Matthew that works but I would also like to be able to change the position of the text on the page.

  4. #4
    Guest
    If it's a richtextbox..than you can use it's alignment functions.

    Code:
    SelAlignment Property
    
    rtfLeft	   0             'Left.  
    The paragraph is aligned along the left margin.
    rtfRight   1             'Right. 
    The paragraph is aligned along the right margin.
    rtfCenter  2	         'Center.  
    The paragraph is centered between the left and right margins.
    
    Richtextbox1.SelAlignment = rtfCenter

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Mar 2000
    Location
    Cairns,North Queensland, Australia
    Posts
    21
    Can the contents of the RichTextBox be put into a variable
    and then positioned on the page using CurrentX and CurrentY.

  6. #6
    Guest
    Code:
    Printer.CurrentX = (Printer.Width - Printer.TextWidth (Richtextbox1.Text)) \ 2 
    Printer.Print Richtextbox1.text & Richtextbox2.text
    Printer.ENDDOC
    I believe you have to put it in yourself.

    Code:
    Richtextbox1.text = Richtextbox1.text & "red..white..blue"
    
    'or
    
    Richtextbox1.Seltext = "red white green blue"

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Mar 2000
    Location
    Cairns,North Queensland, Australia
    Posts
    21
    Thanks again for your help.I don't have time to try it now but I'll try it later.

  8. #8
    Guest
    Just a note, when printing from the RichTextBox, it's a good idea to use the SelPrint method.

    Code:
    RichTextBox1.SelPrint (Printer.hDC)

  9. #9
    Guest
    That will work Megatron...but it is RichTextBox1.SelPrint (Printer.hDC) will only print the textbox stated. AndyB wants to print both Richtextboxes on the same page ;]. But, as always, your "notes" are always useful .

  10. #10

    Thread Starter
    Junior Member
    Join Date
    Mar 2000
    Location
    Cairns,North Queensland, Australia
    Posts
    21
    I also want to be able to print the contents of the RichTextBoxes to the place of my choosing on the page. If I could do that, it would make my day better than it has already been.

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