form1.vb

来自「实现实例的应用」· VB 代码 · 共 27 行

VB
27
字号
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If ListBox1.SelectedIndex = 0 Then
            Label1.ForeColor = Color.Red
        End If
        If ListBox1.SelectedIndex = 1 Then
            Label1.ForeColor = Color.Blue
        End If
        If ListBox1.SelectedIndex = 2 Then
            Label1.ForeColor = Color.Green
        End If
    End Sub

    Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged

    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        ListBox1.Items.Insert(0, textbox1.text)
    End Sub
End Class

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?