回覆列表
  • 1 # 使用者3456175603979

    VB可以用CurrentX、CurrentY 屬性實現定位列印。用ScaleMode 屬性確定印表機物件座標的度量單位。

    CurrentX、CurrentY 屬性,返回或設定下一次列印或繪圖方法的 水平 (CurrentX) 或垂直

    (CurrentY) 座標。

    ScaleMode 屬性,當使用圖形方法或調整控制元件位置時,返回或設定一個值,該值指示物件座標的度量單位。

    具體實現程式碼:

    Option Explicit

    Dim X As Long

    Dim y As Long

    Dim fnt As Variant

    Dim txt As String

    Dim dy As Variant

    Public Function prnt(X As Variant, y As Variant, fnt As Variant, txt As Variant)

    Printer.CurrentX = X

    Printer.CurrentY = y

    Printer.FontSize = fnt

    Printer.Print txt

    End Function

    Private Sub Command1_Click()

    Printer.ScaleMode = 6 "以mm定位

    Printer.CurrentX = 10

    Printer.CurrentY = 20

    fnt = 12

    txt = "YD(0)"

    dy = prnt(X, y, fnt, txt)

    Printer.EndDoc

    End Sub

  • 中秋節和大豐收的關聯?
  • 如果S8 RNG輸了會怎樣?