Public Class Form1 Private KeySelections As New Dictionary(Of String, Keys) Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load KeySelections.Add("Home", Keys.Home) KeySelections.Add("Insert", Keys.Insert) ComboBox1.Items.AddRange(KeySelections.Keys.ToArray) End Sub Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As Boolean If ComboBox1.SelectedIndex > -1 Then Dim hotkey As Keys = KeySelections.Item(ComboBox1.SelectedItem.ToString) If keyData = hotkey Then Me.Timer1.Enabled = Not Me.Timer1.Enabled If Timer1.Enabled Then Label1.Text = "Timer 1 On" Else Label1.Text = "Timer 1 Off" End If End If End If Return MyBase.ProcessCmdKey(msg, keyData) End Function End Class
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)