共用方式為


Printer.Line 方法 (Single, Single, Single, Single, Int32, Boolean, Boolean)

在頁面上列印線條、方形或矩形。

命名空間:  Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6
組件:  Microsoft.VisualBasic.PowerPacks.Vs (在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)

語法

'宣告
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
)

參數

  • x1
    類型:Single

    Single 值,代表要列印的線條的起點的水平座標值。

  • y1
    類型:Single

    Single 值,代表要列印的線條的起點的垂直座標值。

  • x2
    類型:Single

    Single 值,代表要列印的線條的終點的水平座標值。

  • y2
    類型:Single

    Single 值,代表要列印的線條的終點的垂直座標值。

  • color
    類型:Int32

    選擇項。 Integer 值,表示線條的 RGB (紅-綠-藍) 色彩。 如果省略這個參數,則會使用 Black 的值。

  • box
    類型:Boolean

    選擇項。 Boolean. 如果這個參數設定為 true,則會列印矩形。 x1、 y1、 x2 以及y2座標會指定矩形的對角。

  • fill
    類型:Boolean

    選擇項。 Boolean. 如果使用 box 參數,而且 fill 參數設為 true,則會以用來列印矩形的相同色彩來填滿矩形。 您不可以在沒有 box 的情況下使用 fill。 如果未搭配 fill 使用 box,則會使用目前的 FillColorFillStyle 值來填滿矩形。 FillStyle 的預設值為透明。

備註

若要列印連接線,請在上一行的端點啟動下一行。

要列印的線條的寬度取決於 DrawWidth 屬性的設定。 行列印的方式取決於 DrawStyle 屬性的設定。

當 Line 執行時, CurrentXCurrentY 屬性設定為參數指定的端點。

注意事項注意事項

Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6 命名空間中的函式和物件都是供這些工具使用,以便從 Visual Basic 6.0 升級至 Visual Basic。在大多數情況下,這些函式和物件會複製在 .NET Framework 的其他命名空間中可以找到的功能。只有當 Visual Basic 6.0 程式碼模型與 .NET Framework 實作有顯著差異時,才需要這些項目。

範例

下列範例示範如何繪製矩形。

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 安全性

請參閱

參考

Printer 類別

Line 多載

Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6 命名空間

其他資源

Printer Compatibility Library

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

Deploying Applications That Reference the Printer Compatibility Library