当前位置: 源码素材网 » VB教程 » 详情页

Vb打印实线、虚线、点划线等线条

  •   时间:2018-12-03
  • 概述:打印线条

Vb不只需要打印文字,在某些特殊场合,还需要打印出一些风格不同的线条,比如实线、点划线、虚线、双点划线、无线、内收实线等线条,用Vb实现这些线段的打印,并不复杂,源码分享如下:

VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "打印设置"
   ClientHeight    =   3195
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4350
   LinkTopic       =   "Form1"
   ScaleHeight     =   3195
   ScaleWidth      =   4350
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton Command1 
      Caption         =   "打印"
      Height          =   420
      Left            =   1410
      TabIndex        =   2
      Top             =   2640
      Width           =   1605
   End
   Begin VB.ComboBox Combo1 
      Height          =   300
      Left            =   975
      TabIndex        =   0
      Text            =   "Combo1"
      Top             =   180
      Width           =   3330
   End
   Begin VB.Label Label1 
      Caption         =   "线型设置:"
      Height          =   330
      Left            =   60
      TabIndex        =   1
      Top             =   240
      Width           =   1590
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
  Printer.DrawStyle = Combo1.ListIndex
  Printer.CurrentX = 200
  Printer.CurrentY = 200
  Printer.Print "有限公司"
  '打印横线
  Printer.Line (300, 1000)-(2700, 1000)
  Printer.EndDoc
End Sub
Private Sub Form_Load()
  Combo1.AddItem "(默认值)实线"
  Combo1.AddItem "虚线"
  Combo1.AddItem "点线"
  Combo1.AddItem "点划线"
  Combo1.AddItem "双点划线"
  Combo1.AddItem "无线"
  Combo1.AddItem "内收实线"
  Combo1.ListIndex = 0
End Sub

    相关声明:

      若“Vb打印实线、虚线、点划线等线条”有损您的权益,请告之我们删除内容。
      部分文章来源于网络,版权归原作者所有。