Results 1 to 3 of 3

Thread: CurrentX with Printer Object [RESOLVED]

  1. #1

    Thread Starter
    Fanatic Member mateo107's Avatar
    Join Date
    Jan 2005
    Posts
    547

    Resolved CurrentX with Printer Object [RESOLVED]

    Hello All!

    I've decided that I'm VB-enough to try a stab at using the Printer Object. I'm learning all the ins and outs, and trying out lots of test code.

    In my example, I have set the page Height and Width, and am able to get the proper justification.

    Similarly, I've found that if I use repeating lines of
    VB Code:
    1. Printer.Print "This is one line of text..."
    2. Printer.Print "This is another line of text..."
    3. Printer.Print "This is still yet ANOTHER line of text..."
    4. Printer.Print "ANOTHER VARIANT MAY BE ALL CAPS!"
    5. Printer.Print "ANoTHEr MaY hAVe A MIxtuRe of CApS and NoN-CaPs!?"
    And the next line happens to be over the page border I've set, it will automatically put in a NewPage.... I wonder if that's good or not.

    Anyway, my real question is. I want to set a border up, of say, .5 inches (720 twips) on the left and right margins. Do I have to put:
    VB Code:
    1. Printer.CurrentX = 720
    before each line, or is there a simplier way? It gets VERY redundant!


    RESOLVED: ScaleMode did it!
    Any ideas would be helpful! Thanks!
    Last edited by mateo107; Jun 4th, 2005 at 02:09 PM. Reason: RESOLVED


    -Matthew-

  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: CurrentX with Printer Object

    From MSDN

    Scale Properties
    The Printer object has these scale properties:
    • ScaleMode
    • ScaleLeft and ScaleTop
    • ScaleWidth and ScaleHeight
    • Zoom
    The ScaleLeft and ScaleTop properties define the x- and y-coordinates, respectively, of the upper-left corner of a printable page. By changing the values of ScaleLeft and ScaleTop, you can create left and top margins on the printed page. For example, you can use ScaleLeft and ScaleTop to center a printed form (PFrm) on the page using these statements:

    Printer.ScaleLeft = -((Printer.Width - PFrm.Width) / 2)
    Printer.ScaleTop = -((Printer.Height - PFrm.Height) _
    / 2)

  3. #3
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: CurrentX with Printer Object

    You can also set the paper size if it is a predefined standard size:
    VB Code:
    1. 'e.g. Set papersize to A4
    2. Printer.PaperSize  = vbPRPSA4
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

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