📄 frmdisplay.frm
字号:
VERSION 5.00
Begin VB.Form frmDisplay
Caption = "Fig. 4.8: Displaying characters in a label"
ClientHeight = 2415
ClientLeft = 60
ClientTop = 345
ClientWidth = 5355
LinkTopic = "Form1"
ScaleHeight = 2415
ScaleWidth = 5355
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton cmdPrint
Caption = "Print"
Height = 495
Left = 2100
TabIndex = 2
Top = 1815
Width = 1215
End
Begin VB.TextBox txtInput
Height = 300
Left = 3405
MaxLength = 1
TabIndex = 0
Top = 195
Width = 1215
End
Begin VB.Label lblPrompt
Caption = "Enter an Integer (1-9) and press Print:"
Height = 270
Left = 540
TabIndex = 3
Top = 225
Width = 2730
End
Begin VB.Label lblDisplay
Alignment = 2 'Center
BeginProperty Font
Name = "Courier"
Size = 48
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1050
Left = 60
TabIndex = 1
Top = 615
Width = 5220
End
End
Attribute VB_Name = "frmDisplay"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' Fig 4.8
' Program displays #'s in a Label
Option Explicit ' General Declaration
Private Sub cmdPrint_Click()
Dim counter As Integer ' Declaration
counter = txtInput.Text ' Get number of characters
lblDisplay.Caption = "" ' Clear Label
' Repeat the statements between Do While and Loop
' until counter has a value of 0.
Do While counter > 0
lblDisplay.Caption = lblDisplay.Caption & "#"
counter = counter - 1 ' Decrement number
Loop
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -