题库 题库

【简答题】

 
Dim which As Integer
Private Sub copy_Click()
    If which = 1 Then
        Text3.Text = Text1.Text
    ElseIf which = 2 Then
        Text3.Text = Text2.Text
    End If
End Sub
Private Sub cut_Click()
    If which = 1 Then
        Text3.Text = Text1.Text
        Text1.Text = ""
    ElseIf which = 2 Then
        Text3.Text = Text2.Text
        Text2.Text = ""
    End If
End Sub
Private Sub edit_Click()
'    If which = ? Then
        If Text1.Text = "" Then
            cut.Enabled = False
            copy.Enabled = False
        Else
            cut.Enabled = True
            copy.Enabled = True
        End If
'    ElseIf which = ? Then
        If Text2.Text = "" Then
            cut.Enabled = False
            copy.Enabled = False
        Else
            cut.Enabled = True
            copy.Enabled = True
        End If
    End If
    If Text3.Text = "" Then
        paste.Enabled = False
    Else
        paste.Enabled = True
    End If
End Sub
Private Sub paste_Click()
    If which = 1 Then
'        Text1.Text = ?
    ElseIf which = 2 Then
'        Text2.Text = ?
    End If
End Sub
Private Sub Text1_GotFocus()  '本过程的作用是:当焦点在Text1中时,which = 1
    which = 1
End Sub
Private Sub Text2_GotFocus()  '本过程的作用是:当焦点在Text2中时,which = 2
    which = 2
End Sub

参考答案

Dim which As Integer
Private Sub copy_Click()
    If which = 1 Then
        Text3.Text = Text1.Text
    ElseIf which = 2 Then
        Text3.Text = Text2.Text
    End If
End Sub
Private Sub cut_Click()
    If which = 1 Then
        Text3.Text = Text1.Text
        Text1.Text = ""
    ElseIf which = 2 Then
        Text3.Text = Text2.Text
        Text2.Text = ""
    End If
End Sub
Private Sub edit_Click()
    If which = 1 Then
        If Text1.Text = "" Then
            cut.Enabled = False
            copy.Enabled = False
        Else
            cut.Enabled = True
            copy.Enabled = True
        End If
    ElseIf which = 2 Then
        If Text2.Text = "" Then
            cut.Enabled = False
            copy.Enabled = False
        Else
            cut.Enabled = True
            copy.Enabled = True
        End If
    End If
    If Text3.Text = "" Then
        paste.Enabled = False
    Else
        paste.Enabled = True
    End If
End Sub
Private Sub paste_Click()
    If which = 1 Then
        Text1.Text = Text1 + Text3.Text
    ElseIf which = 2 Then
        Text2.Text = Text2 + Text3.Text
    End If
End Sub
Private Sub Text1_GotFocus()  '本过程的作用是:当焦点在Text1中时,which = 1
    which = 1
End Sub
Private Sub Text2_GotFocus()  '本过程的作用是:当焦点在Text2中时,which = 2
    which = 2
End Sub

相关试题