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

public void Line(
    float x1,
    float y1,
    float x2,
    float y2,
    int color = -1,
    bool box = false,
    bool fill = false
)
public:
void Line(
    float x1,
    float y1,
    float x2,
    float y2,
    int color = -1,
    bool box = false,
    bool fill = false
)
member Line : 
        x1:float32 *
        y1:float32 *
        x2:float32 *
        y2:float32 *
        color:int = -1 *
        box:bool = false *
        fill:bool = false -> unit
Public Sub Line (
    x1 As Single,
    y1 As Single,
    x2 As Single,
    y2 As Single,
    color As Integer,
    box As Boolean,
    fill As 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. 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()

See Also

Line Overload
Printer Class
Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6 Namespace

4e434922-3709-49c6-a69d-38120ed72d7abc1bcb98-e13b-4c68-a514-045c042dbf367f9351ea-cb3e-4615-8f70-5a29c165c1a7

Return to top