DOC

vb

By Maria Perkins,2014-05-27 05:55
9 views 0
vb

黑白格布

    

2-1

    Private Sub Form_Click()

     Cls

    End Sub

    Private Sub Form_DblClick()

     FontSize = 40

     FontName = "隶书"

     ForeColor = vbRed

     Print "热烈庆祝"

     FontSize = 60

     FontName = "宋体"

     ForeColor = vbGreen

     Print "河南大学运动会召开" End Sub

    2-22-4

    Private Sub Timer1_Timer()

     Text1.Text = Now

     Caption = Text1.Text

    End Sub

    2-5

    Private Sub Timer1_Timer()

     If BackColor = vbRed Then

     BackColor = vbYellow

     Else

     BackColor = vbRed

     End If

    End Sub

    2-6

    Private Sub Timer1_Timer()

     If Label1.Left < Form1.Width Then

     Label1.Left = Label1.Left + 200

     Else

     Label1.Left = -Label1.Left

     End If

    End Sub

    2-7

    Private Sub Command1_Click()

     Text1.Visible = True

    End Sub

    Private Sub Command2_Click()

     Text1.Visible = False

    End Sub

    2-8

    Private Sub Text1_Change()

     Text2.Text = Text1.Text

    End Sub

    2-9

    Private Sub Command1_Click()

     FontSize = 20

     FontBold = True

     Print "欢迎来到"

     Print "河南大学"

    End Sub

    Private Sub Command2_Click()

     Cls

    End Sub

    Private Sub Command3_Click()

     End

    End Sub

    2-10

    Private Sub Command1_Click()

     r = Text1.Text

     Text2.Text = 3.14 * 2 * r

    End Sub

    Private Sub Command2_Click()

     Text1.Text = " "

     Text2.Text = " "

     Text1.SetFocus

    End Sub

    2-11

    Private Sub Form_Load()

     Text1.Text = "河南大学欢迎您?"

     Text1.FontName = "宋体"

     Text1.FontSize = 50

     Text1.BackColor = vbYellow

     Text1.ForeColor = vbBlue End Sub

    2-12

     Dim s As String

    Private Sub Command1_Click()

     s = Text1.SelText

    End Sub

    Private Sub Command2_Click()

     Text2.SelText = s

End Sub

    2-13

    Private Sub Timer1_Timer()

     If Label1.Top > -Label1.Height Then

     Label1.Top = Label1.Top - 100

     Else

     Label1.Top = Form1.Height

     End If

    End Sub

    3-2

    Private Sub Form_Click()

     Dim n As Integer

     Randomize

     n = Int((90 * Rnd) + 10)

     Print n

    End Sub

    3-3

    Private Sub Timer1_Timer()

     Cls

     Print "河南大学环境与规划学院"

     FontSize = Int(71 * Rnd + 10) End Sub

    3-4

    Private Sub Command1_Click()

     n = Text1.Text

     Text2.Text = Hex(Asc(Right(Text1.Text, 1)))

    End Sub

    Private Sub Command2_Click()

     Text1.Text = " "

     Text2.Text = " "

     Text1.SetFocus

    End Sub

    3-5

    Private Sub Command1_Click()

     Dim m As Date

     m = Text1.Text

     n = Date

     Text2.Text = n - m

    End Sub

    Private Sub Command2_Click()

     Text1.Text = ""

     Text2.Text = ""

     Text1.SetFocus

    End Sub

3-6

     Dim b As String

     Dim n As String

     Dim m As String

    Private Sub Command1_Click()

     m = Left(Text1, 1)

     n = Right(Text1, 1)

     b = Mid(Text1, 2, 1)

     Text2.Text = n & b & m

    End Sub

    Private Sub Command2_Click()

     Text1.Text = ""

     Text2.Text = ""

     Text1.SetFocus

    End Sub

    3