?? frmdraw.frm
字號:
VERSION 5.00
Begin VB.Form frmDraw
Caption = "Fig. 4.16: Printing a square on the form"
ClientHeight = 4200
ClientLeft = 2805
ClientTop = 2010
ClientWidth = 5115
BeginProperty Font
Name = "Courier"
Size = 11.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
ScaleHeight = 4200
ScaleWidth = 5115
Begin VB.TextBox txtPrompt
BackColor = &H00C0C0C0&
BorderStyle = 0 'None
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 90
Locked = -1 'True
TabIndex = 2
Text = "Enter an Integer (1-12) and press Draw:"
Top = 3000
Width = 3540
End
Begin VB.TextBox txtInput
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 3720
TabIndex = 0
Text = "0"
Top = 2985
Width = 1215
End
Begin VB.CommandButton cmdDraw
Caption = "Draw"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1980
TabIndex = 1
Top = 3450
Width = 1215
End
End
Attribute VB_Name = "frmDraw"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' Fig. 4.16
' Program draws a square of $ on the form
Option Explicit ' In general Declaration
Private Sub cmdDraw_Click()
Dim side As Integer, row As Integer, column As Integer
side = txtInput.Text ' Get user input from TextBox
Cls ' Clear the form
If side <= 12 Then ' If True, the next If is tested
If side > 0 Then
row = 1 ' Executed only if the two previous
' If conditions are True.
' Use repetition to draw square of $
While row <= side ' Controls the row
column = 1
' This loop will print one "row" of $ characters.
' Each iteration of the loop prints a single $.
While column <= side
Print "$"; ' Print one $ on the same line
column = column + 1
Wend
Print ' Print to next line
row = row + 1 ' Increment row
Wend
Else ' Condition (side > 0) is False
Print "Side too small."
Beep
End If
Else ' Condition (side <= 12) is False
Print "Side too large."
Beep
End If
End Sub
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -