Share via


Printer.Line Method (Boolean, Single, Single, Boolean, Single, Single, Int32, Boolean, Boolean)

Prints lines, squares, or rectangles on a page.

Namespace:  Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)

Syntax

'Declaration
Public Sub Line ( _
    relativeStart As Boolean, _
    x1 As Single, _
    y1 As Single, _
    relativeEnd As Boolean, _
    x2 As Single, _
    y2 As Single, _
    color As Integer, _
    box As Boolean, _
    fill As Boolean _
)
public void Line(
    bool relativeStart,
    float x1,
    float y1,
    bool relativeEnd,
    float x2,
    float y2,
    int color,
    bool box,
    bool fill
)
public:
void Line(
    bool relativeStart, 
    float x1, 
    float y1, 
    bool relativeEnd, 
    float x2, 
    float y2, 
    int color, 
    bool box, 
    bool fill
)
member Line : 
        relativeStart:bool * 
        x1:float32 * 
        y1:float32 * 
        relativeEnd:bool * 
        x2:float32 * 
        y2:float32 * 
        color:int * 
        box:bool * 
        fill:bool -> unit 
public function Line(
    relativeStart : boolean, 
    x1 : float, 
    y1 : float, 
    relativeEnd : boolean, 
    x2 : float, 
    y2 : float, 
    color : int, 
    box : boolean, 
    fill : boolean
)

Parameters

  • relativeStart
    Type: System.Boolean
    Boolean . If this parameter is set to true, the starting coordinates are relative to the coordinates given by the CurrentX and CurrentY properties of the Printer object.
  • x1
    Type: System.Single
    Single value indicating the horizontal coordinate of the starting point for the line being printed.
  • y1
    Type: System.Single
    Single value indicating the vertical coordinate of the starting point for the line being printed.
  • relativeEnd
    Type: System.Boolean
    Boolean . If this parameter is set to true, the ending coordinates are relative to the coordinates given by the CurrentX and CurrentY properties of the Printer object.
  • x2
    Type: System.Single
    Single value indicating the horizontal coordinate of the endpoint for the line being printed.
  • y2
    Type: System.Single
    Single value indicating the vertical coordinate of the endpoint for the line being printed.
  • color
    Type: System.Int32
    Optional. Integer value indicating the RGB (red-green-blue) color of the line. If this parameter is omitted, the value of Black is used.
  • box
    Type: System.Boolean
    Optional. Boolean. If this parameter is set to true, a rectangle is printed. The x1, y1, x2, and y2 coordinates specify opposite corners of the rectangle.
  • fill
    Type: System.Boolean
    Optional. Boolean. If the box parameter is used and the fill parameter is set to true, the rectangle is filled with the same color used to print the rectangle. you cannot use fill without box. If box is used without fill, the current FillColor and FillStyle values are used to fill the rectangle. The default value for FillStyle is transparent.

Remarks

To print connected lines, begin a subsequent line at the endpoint of the previous line.

The width of the line printed depends on the setting of the DrawWidth property. The manner in which a line is printed depends on the setting of the DrawStyle property.

When Line runs, the CurrentX and CurrentY properties are set to the endpoint specified by the parameters.

Note

Functions and objects in the Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6 namespace are provided for use by the tools for upgrading from Visual Basic 6.0 to Visual Basic 2010. In most cases, these functions and objects duplicate functionality that you can find in other namespaces in the .NET Framework. They are necessary only when the Visual Basic 6.0 code model differs significantly from the .NET Framework implementation.

Examples

The following example demonstrates how to draw a rectangle.

Dim pr As New Printer
pr.CurrentX = 500
pr.CurrentY = 500
pr.Line(True, 500, 500, 2000, 2000, vbRed, True, True)
pr.EndDoc()

.NET Framework Security

See Also

Reference

Printer Class

Line Overload

Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6 Namespace

Other Resources

Printer Compatibility Library

How to: Fix Upgrade Errors by Using the Printer Compatibility Library (Visual Basic)

Deploying Applications That Reference the Printer Compatibility Library