计算机类二级VB

二级VB上机题库22

10 题含答案VB
共 10 题返回本类
2材料分析题2 / 10
  
查看答案
Private Sub Form_Click()
    List1.RemoveItem List1.ListCount - 1
'或    List1.RemoveItem 3
End Sub
Private Sub Form_Load()
    List1.List(List1.ListCount - 1) = "英语"
'或    List1.List(3) = "英语"
End Sub
3材料分析题3 / 10
  
查看答案
Private Sub Option1_Click()
    Text1.Alignment = 0
End Sub
Private Sub Option2_Click()
    Text1.Alignment = 2
End Sub
Private Sub Option3_Click()
    Text1.Alignment = 1
End Sub
Private Sub Option4_Click()
    Text1.Font = "宋体"
'    Text1.FontName = "宋体"
'    Text1.Font.Name = "宋体"
End Sub
Private Sub Option5_Click()
    Text1.Font = "黑体"
'    Text1.FontName = "黑体"
'    Text1.Font.Name = "黑体"
End Sub
4材料分析题4 / 10
   
Private Sub Command1_Click()
    Timer1.Enabled = True
End Sub
Private Sub Command2_Click()
'    ?
    Timer1.Enabled = False
End Sub
Private Sub Form_Activate()
'    For k = 0 To 359 Step ?
'        x = radius * Cos(k * 3.14159 / 180) + ?
        y = y0 - radius * Sin(k * 3.14159 / 180)
        Form1.Circle (x, y), 20
    Next k
    a = 90
    b = 90
    len1 = Line1.Y1 - Line1.Y2
    len2 = Line2.Y1 - Line2.Y2
End Sub
Private Sub Timer1_Timer()
    a = a - 30
    Line1.X2 = len1 * Cos(a * 3.14159 / 180) + x0
'    Line1.? = y0 - len1 * Sin(a * 3.14159 / 180)
'    b = ? - 30 / 12
    Line2.X2 = len2 * Cos(b * 3.14159 / 180) + x0
    Line2.Y2 = y0 - len2 * Sin(b * 3.14159 / 180)
End Sub
查看答案
    For k = 0 To 359 Step 360 / 12
        x = radius * Cos(k * 3.14159 / 180) + x0
    Line1.Y2 = y0 - len1 * Sin(a * 3.14159 / 180)
    b = b - 30 / 12
5材料分析题5 / 10
   
Private Sub Command1_Click()
    Dim ch As String
    Text1 = ""
    Open App.Path & "\in5.dat" For Input As #1
    For k = 1 To 5
        Input #1, ch
        athlete(k) = ch
        Text1 = Text1 & ch & "  "
        For j = 1 To 8
            Input #1, ch
            a(k, j) = Val(ch)
            Text1 = Text1 & ch & "  "
        Next j
        Text1 = Text1 & Chr(13) & Chr(10)
    Next k
    Close #1
End Sub
Private Function getmark(n As Integer) As Single
'    s = ?
    maxnum = s
    minnum = s
'    For k = 2 To ?
        s = s + a(n, k)
        If maxnum < a(n, k) Then
            maxnum = a(n, k)
        End If
        If minnum > a(n, k) Then
            minnum = a(n, k)
        End If
    Next k
    s = (s - maxnum - minnum) / 5
'    getmark = s * 3 * ?
End Function
Private Sub Command2_Click()
' 要求考生编写的程序
查看答案
    s = a(n, 1)
    For k = 2 To 7
    getmark = s * 3 * a(n, 8)
程序
    Dim k As Integer
    maxmark = getmark(1)
    m = 1
    For k = 2 To 5
        If maxmark < getmark(k) Then
            maxmark = getmark(k)
            m = k
        End If
    Next k
    Text2 = athlete(m)
    Text3 = maxmark
End Sub
Private Sub Command3_Click()
    Open App.Path & "\out5.dat" For Output As #1
    Print #1, Text2, Text3
    Close #1
End Sub
8材料分析题8 / 10
   
Private Sub Text1_Change()
    Dim ch As String
'    ch = Right$( ? )
    ch = Right$(Text1, 1)
    If ch >= "A" And ch <= "Z" Then
        Label1.Caption = LCase(ch)
        n = n + 1
    ElseIf ch >= "a" And ch <= "z" Then
        Label1.Caption = UCase(ch)
        n = n + 1
    Else
'        Label1.Caption = ?
        Label1.Caption = Right$(Text1, 1)
    End If
'    Label2.Caption = ?
    Label2.Caption = n
End Sub
查看答案
'Text1, 1  或 Text1.Text, 1  或 Form1.Text1.Text, 1  或 Form1.Text1, 1
'ch 或 Right$(Text1, 1)
'  或 Right$(Text1.Text, 1)
'  或 Right$(Form1.Text1, 1)
'  或 Right$(Form1.Text1.Text, 1)
'  或 Right(Text1, 1)
'  或 Right(Text1.Text, 1)
'  或 Right(Form1.Text1, 1)
'  或 Right(Form1.Text1.Text, 1)
'n
9材料分析题9 / 10
   
Private Sub Command1_Click()
'    Timer1.Enabled = ?
    Timer1.Enabled = True
End Sub
Private Sub Command2_Click()
    Timer1.Enabled = False
End Sub
Private Sub Form_Load()
    left0 = Shape1.Left
End Sub
Private Sub Timer1_Timer()
    If Shape1.FillColor = blue_color Then
        If Shape1.Left > 0 Then
            Shape1.Height = Shape1.Height + 100
            Shape1.Width = Shape1.Width + 100
            Shape1.Left = Shape1.Left - 50
            Shape1.Top = Shape1.Top - 50
        Else
'            Shape1.FillColor = ?
            Shape1.FillColor = red_color
        End If
    End If
    If Shape1.FillColor = red_color Then
        If Shape1.Left < left0 Then
            Shape1.Height = Shape1.Height - 100
            Shape1.Width = Shape1.Width - 100
'            ? = Shape1.Left + 50
            Shape1.Left = Shape1.Left + 50
'            ? = Shape1.Top + 50
            Shape1.Top = Shape1.Top + 50
        Else
'            Shape1.FillColor = ?
            Shape1.FillColor = blue_color
        End If
    End If
End Sub
查看答案
'True
'red_coler  或 &HFF&
'Shape1.Left
'Shape1.Top
'blue_coler  或 &HFF0000
10材料分析题10 / 10
  
   
   
Private Sub Command1_Click()
    Dim s As String
    CommonDialog1.Filter = "所有文件|*.*|文本文件|*.txt"
'    CommonDialog1.FilterIndex = ?
    On Error GoTo openerr
    CommonDialog1.InitDir = App.Path
    CommonDialog1.ShowOpen
'    Open ? For Input As #1
    Input #1, s
    Close #1
'    Text1.Text = ?
openerr:
End Sub
Private Sub Command2_Click()
======================
' 考生需要编写的程序
======================
End Sub
Private Sub Command3_Click()
    CommonDialog1.Filter = "文本文件|*.txt|所有文件|*.*"
    CommonDialog1.FilterIndex = 1
    On Error GoTo openerr
    CommonDialog1.FileName = "out5.txt"
    CommonDialog1.InitDir = App.Path
'    CommonDialog1.Action = ?
    Open CommonDialog1.FileName For Output As #1
    Print #1, Text1
    Close #1
openerr:
End Sub
查看答案
Private Sub Command1_Click()
    Dim s As String
    CommonDialog1.Filter = "所有文件|*.*|文本文件|*.txt"
    CommonDialog1.FilterIndex = 2
    On Error GoTo openerr
    CommonDialog1.InitDir = App.Path
    CommonDialog1.ShowOpen
    Open CommonDialog1.FileName For Input As #1
    Input #1, s
    Close #1
    Text1.Text = s
openerr:
End Sub
Private Sub Command2_Click()
    s = ""
    str_len = Len(Text1)
    For k = 1 To str_len
        ch = Mid$(Text1, k, 1)
        If ch = "E" Or ch = "N" Or ch = "T" Then
            s = s & LCase(ch)
        ElseIf ch = "e" Or ch = "n" Or ch = "t" Then
            s = s & UCase(ch)
        Else
            s = s & ch
        End If
    Next k
    Text1 = s
End Sub
Private Sub Command3_Click()
    CommonDialog1.Filter = "文本文件|*.txt|所有文件|*.*"
    CommonDialog1.FilterIndex = 1
    On Error GoTo openerr
    CommonDialog1.FileName = "out5.txt"
    CommonDialog1.InitDir = App.Path
    CommonDialog1.Action = 2
    Open CommonDialog1.FileName For Output As #1
    Print #1, Text1
    Close #1
openerr:
End Sub
← 上一卷下一卷 →