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 _
)
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
)
member Line :
x1:float32 *
y1:float32 *
x2:float32 *
y2:float32 *
color:int *
box:bool *
fill:bool -> unit
public function Line(
x1 : float,
y1 : float,
x2 : float,
y2 : float,
color : int,
box : boolean,
fill : boolean
)
Parameters
x1
Type: System.SingleSingle value indicating the horizontal coordinate of the starting point for the line being printed.
y1
Type: System.SingleSingle value indicating the vertical coordinate of the starting point for the line being printed.
x2
Type: System.SingleSingle value indicating the horizontal coordinate of the endpoint for the line being printed.
y2
Type: System.SingleSingle value indicating the vertical coordinate of the endpoint for the line being printed.
color
Type: System.Int32Optional. 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.BooleanOptional. 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.BooleanOptional. 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()
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6 Namespace
Other Resources
How to: Fix Upgrade Errors by Using the Printer Compatibility Library (Visual Basic)
Deploying Applications That Reference the Printer Compatibility Library