Printer.NET


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Printer.NET

  1. #1
    Lin Guest

    Printer.NET


    Can you help me with the following issues: Thanks - Lin

    How do you implement in VB.NET to replace VB6 Printer object with the following
    methods & properties:

    printer.Circle
    printer.ColorMode
    printer.Copies
    printer.CurrentX
    printer.CurrentY
    printer.DeviceName
    printer.DrawMode
    printer.DrawStyle
    printer.DrawWidth
    printer.DriverName
    printer.Duplex
    printer.EndDoc
    printer.FillColor
    printer.FillStyle
    printer.Font
    printer.FontBold
    printer.FontCount
    printer.FontItalic
    printer.FontName
    printer.Fonts
    printer.FontSize
    printer.FontStrikethru
    printer.FontTransparent
    printer.FontUnderline
    printer.ForeColor
    printer.hDC
    printer.Height
    printer.KillDoc
    printer.Line
    printer.NewPage
    printer.Orientation
    printer.Page
    printer.PaintPicture
    printer.PaperBin
    printer.PaperSize
    printer.Port
    printer.PrintQuality
    printer.PSet
    printer.RightToLeft
    printer.Scale
    printer.ScaleHeight
    printer.ScaleLeft
    printer.ScaleMode
    printer.ScaleTop
    printer.ScaleWidth
    printer.ScaleX
    printer.ScaleY
    printer.TextHeight
    printer.TextWidth
    printer.TrackDefault
    printer.TwipsPerPixelX
    printer.TwipsPerPixelY
    printer.Width
    printer.Zoom


  2. #2
    VBDotNet Team [MS] Guest

    Re: Printer.NET

    Hi there-

    You're going to want to look into the PrintDocument, PageSettings and
    PrinterSettings classes. You might also find the PrintPreviewDialog
    component useful. The .NET printing functionality is considerably different
    from VB6, so you will probably want to thoroughly read the documentation on
    these classes. Hope this helps!

    Matthew Stoecker and Shamez Rajan
    Visual Basic

    --
    This posting is provided "AS IS" with no warranties, and confers no rights.
    "Lin" <Shihchung.Lin@TriZetto.com> wrote in message
    news:3d122818$1@10.1.10.29...
    >
    > Can you help me with the following issues: Thanks - Lin
    >
    > How do you implement in VB.NET to replace VB6 Printer object with the

    following
    > methods & properties:
    >
    > printer.Circle
    > printer.ColorMode
    > printer.Copies
    > printer.CurrentX
    > printer.CurrentY
    > printer.DeviceName
    > printer.DrawMode
    > printer.DrawStyle
    > printer.DrawWidth
    > printer.DriverName
    > printer.Duplex
    > printer.EndDoc
    > printer.FillColor
    > printer.FillStyle
    > printer.Font
    > printer.FontBold
    > printer.FontCount
    > printer.FontItalic
    > printer.FontName
    > printer.Fonts
    > printer.FontSize
    > printer.FontStrikethru
    > printer.FontTransparent
    > printer.FontUnderline
    > printer.ForeColor
    > printer.hDC
    > printer.Height
    > printer.KillDoc
    > printer.Line
    > printer.NewPage
    > printer.Orientation
    > printer.Page
    > printer.PaintPicture
    > printer.PaperBin
    > printer.PaperSize
    > printer.Port
    > printer.PrintQuality
    > printer.PSet
    > printer.RightToLeft
    > printer.Scale
    > printer.ScaleHeight
    > printer.ScaleLeft
    > printer.ScaleMode
    > printer.ScaleTop
    > printer.ScaleWidth
    > printer.ScaleX
    > printer.ScaleY
    > printer.TextHeight
    > printer.TextWidth
    > printer.TrackDefault
    > printer.TwipsPerPixelX
    > printer.TwipsPerPixelY
    > printer.Width
    > printer.Zoom
    >




  3. #3
    michiel de bruijn Guest

    Re: Printer.NET

    Hi Lin,

    > How do you implement in VB.NET to replace VB6 Printer object with the

    following
    > methods & properties:


    Only with great difficulty. The problem is not so much creating a class with
    the relevant properties etc., as most of these map directly to one of the
    ..NET framework printer classes from System.Drawing.Printing (the "Printer
    Object Changes in Visual Basic.NET" help topic contains a good overview of
    which parts of the VB6 Printer object map to which Visual Basic .NET
    property or method). For example, you could easily implement the Copies
    property as follows:

    Public Class Printer
    Private m_pd As New PrintDocument()

    Public Property Copies() As Integer
    Get
    Copies = m_pd.PrinterSettings.Copies
    End Get
    Set(ByVal Value As Integer)
    m_pd.PrinterSettings.Copies = Value
    End Set
    End Property
    End Class

    However, you'll soon notice that:
    * Many VB6 properties and functions simply have no equivalent in VB.NET
    * Most importantly, the entire concept of printing has fundamentally changed
    in VB.NET (this will become very apparent if you look at the help for the
    PrintDocument Print event)

    If you have a lot of complex VB6 printing code, converting this to native
    ..NET code will be a daunting task, but it can be quite worthwhile, as the
    new printing methods are a lot more sane than the old ones, and also enable
    advanced functionality (like print previews) that was very hard to implement
    in VB before.

    If the conversion turns out to be infeasible, I still wouldn't recommend
    trying to build your own VB6 Printer object. Not only is it a lot of work,
    the resulting output may turn out to be inaccurate (due to the new
    coordinate system, etc.), resulting in all kinds of hard-to-maintain
    kludges. You may want to consider the following alternatives:

    * Keep your printing code in an ActiveX DLL, and call it from your .NET
    project using COM Interop. You'll still want to migrate this code to .NET at
    some point.
    * Use a 'halfway' solution, like ComponentOne's Preview (the .NET equivalent
    of the old VSVIEW). Although code changes will still be required, the object
    model is closer to VB6's Printer object than the .NET way of doing things.

    '//mdb





Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center