📄 frmprint.frm
字号:
VERSION 5.00
Begin VB.Form frmPrint
BackColor = &H00FFFFFF&
Caption = "Fig. 9.6: Printing lines and rectangles to the Form"
ClientHeight = 3195
ClientLeft = 2865
ClientTop = 2340
ClientWidth = 5505
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 5505
Begin VB.CommandButton cmdPrint
Caption = "Print"
Height = 495
Left = 2145
TabIndex = 0
Top = 2520
Width = 1215
End
End
Attribute VB_Name = "frmPrint"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' Fig. 9.6
' Printing lines and rectangles to the form
Option Explicit
Private Sub cmdPrint_Click()
Dim x1 As Single, y1 As Single
Dim x2 As Single, y2 As Single
Call Randomize
' Randomly pick values to draw at
x1 = Rnd() * Width
y1 = Rnd() * Height
x2 = Rnd() * Width
y2 = Rnd() * Height
' Randomly decide which shape
If (Rnd() < 0.5) Then
Line (x1, y1)-(x2, y2) ' Line
Else
Line (x1, y1)-(x2, y2), vbRed, B ' Rectangle
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -