Share via


Printer.Line Method (Single, Single, 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 ( _
    x1 As Single, _
    y1 As Single, _
    x2 As Single, _
    y2 As Single, _
    color As Integer, _
    box As Boolean, _
    fill As Boolean _
)
'Usage
Dim instance As Printer 
Dim x1 As Single 
Dim y1 As Single 
Dim x2 As Single 
Dim y2 As Single 
Dim color As Integer 
Dim box As Boolean 
Dim fill As Boolean

instance.Line(x1, y1, x2, y2, color, box, _
    fill)
public void Line(
    float x1,
    float y1,
    float x2,
    float y2,
    int color,
    bool box,
    bool fill
)
public:
void Line(
    float x1, 
    float y1, 
    float x2, 
    float y2, 
    int color, 
    bool box, 
    bool fill
)
public function Line(
    x1 : float, 
    y1 : float, 
    x2 : float, 
    y2 : float, 
    color : int, 
    box : boolean, 
    fill : boolean
)

Parameters

  • 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.

  • 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 2008. 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(pr.CurrentX, pr.CurrentY, 2000, 2000, vbRed, True, False)
pr.EndDoc()

.NET Framework Security

See Also

Reference

Printer Class

Printer Members

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