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 _
)
'Usage
Dim instance As Printer
Dim relativeStart As Boolean
Dim x1 As Single
Dim y1 As Single
Dim relativeEnd As Boolean
Dim x2 As Single
Dim y2 As Single
Dim color As Integer
Dim box As Boolean
Dim fill As Boolean
instance.Line(relativeStart, x1, y1, relativeEnd, _
x2, y2, color, box, fill)
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
)
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.BooleanBoolean. 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.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.
relativeEnd
Type: System.BooleanBoolean. 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.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.Boolean
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 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(True, 500, 500, 2000, 2000, vbRed, True, True)
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