wordart.frm

来自「vb精彩编程希望大家有用」· FRM 代码 · 共 75 行

FRM
75
字号
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "艺术字"
   ClientHeight    =   4710
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5985
   LinkTopic       =   "Form1"
   ScaleHeight     =   4710
   ScaleWidth      =   5985
   StartUpPosition =   3  '窗口缺省
   Begin VB.PictureBox Picture1 
      Height          =   3975
      Left            =   120
      ScaleHeight     =   3915
      ScaleWidth      =   5715
      TabIndex        =   3
      Top             =   600
      Width           =   5775
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   1200
      TabIndex        =   1
      Top             =   120
      Width           =   3255
   End
   Begin VB.CommandButton Command2 
      Caption         =   "显示"
      Enabled         =   0   'False
      Height          =   375
      Left            =   4800
      TabIndex        =   0
      Top             =   120
      Width           =   975
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "输入文字:"
      Height          =   180
      Left            =   360
      TabIndex        =   2
      Top             =   240
      Width           =   900
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim w As New Word.Application

Private Sub Command1_Click()
    End
End Sub

Private Sub Command2_Click()
    w.Documents.Add.Select
    w.ActiveDocument.Shapes.AddTextEffect _
      (0, Text1.Text, "隶书", 48#, -1, 0, 183.75, 70.5).Select
    w.Selection.ShapeRange.TextEffect.PresetTextEffect = Int(Rnd(1) * 30)
    w.Selection.ShapeRange.TextEffect.FontName = "隶书"
    w.Selection.Copy
    Picture1.Picture = Clipboard.GetData()
End Sub
Private Sub Form_Unload(Cancel As Integer)
    w.Quit wdDoNotSaveChanges
    Set w = Nothing
End Sub

Private Sub Text1_Change()
    Command2.Enabled = Len(Trim$(Text1.Text)) > 0
End Sub

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?