Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Simple printing help

Simple printing help

Scheduled Pinned Locked Moved Visual Basic
graphicshelpquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • X Offline
    X Offline
    xbiplav
    wrote on last edited by
    #1

    I have a textbox control whose multiline property is set to true. I have some text in that textbox control. For the first time I printed those textbox content program through my program. And secondly, when i copy that exact same content in the notepad, and printed it,it prints differently.I want to print those textbox content like the printing from the notepad. Do I have to change any setting in the textbox property so that the textbox content will be printed in the same way that the notepad prints? I think notepad automatically formats the spacing but the textbox control doesnot.So the textbox content doesnot print in the format that i want. I printing using the code: .......... e.Graphics.DrawString(txtPrnt.text, New Font("Tahoma", 8, FontStyle.Regular), Brushes.Black, e.MarginBounds.X, e.MarginBounds.Y) ...........

    A D 2 Replies Last reply
    0
    • X xbiplav

      I have a textbox control whose multiline property is set to true. I have some text in that textbox control. For the first time I printed those textbox content program through my program. And secondly, when i copy that exact same content in the notepad, and printed it,it prints differently.I want to print those textbox content like the printing from the notepad. Do I have to change any setting in the textbox property so that the textbox content will be printed in the same way that the notepad prints? I think notepad automatically formats the spacing but the textbox control doesnot.So the textbox content doesnot print in the format that i want. I printing using the code: .......... e.Graphics.DrawString(txtPrnt.text, New Font("Tahoma", 8, FontStyle.Regular), Brushes.Black, e.MarginBounds.X, e.MarginBounds.Y) ...........

      A Offline
      A Offline
      Ajay k_Singh
      wrote on last edited by
      #2

      I am not very clear as what differences you see, however there would definitely be some difference between the print taken from an application like notepad and from a control like textbox. Any text editor has codes written behind it to format text before it is sent to the printer. Therefore if you need any specific type of formatting in text, you should – 1) Take text value of text box in a string object. 2) Perform whatever formatting you want on this string by writing your code. 3) Send this string object to the printer. I hope this clarifies the scenario. -Dave.

      Dave Traister, ComponentOne LLC. www.componentone.com

      1 Reply Last reply
      0
      • X xbiplav

        I have a textbox control whose multiline property is set to true. I have some text in that textbox control. For the first time I printed those textbox content program through my program. And secondly, when i copy that exact same content in the notepad, and printed it,it prints differently.I want to print those textbox content like the printing from the notepad. Do I have to change any setting in the textbox property so that the textbox content will be printed in the same way that the notepad prints? I think notepad automatically formats the spacing but the textbox control doesnot.So the textbox content doesnot print in the format that i want. I printing using the code: .......... e.Graphics.DrawString(txtPrnt.text, New Font("Tahoma", 8, FontStyle.Regular), Brushes.Black, e.MarginBounds.X, e.MarginBounds.Y) ...........

        D Offline
        D Offline
        Duncan Edwards Jones
        wrote on last edited by
        #3

        As per this article[^] you need to pass a [b]StringTrimming[/b] class to the Graphics.DrawString call to get the text to wrap appropriately.

        '--8<------------------------ Ex Datis: Duncan Jones Merrion Computing Ltd

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups