2011年7月9日土曜日

→→→TextBoxに入力したものがListBoxに表示されていく

キーボード入力
TextBoxに文字を入力すると、もうひとつのListBoxに表示されていく。
また、R+Alt で背景が赤になり、 R+Shift+Alt で元に戻る。

Private Sub Form_Load(...
   Me.KeyPreview = True
End Sub

Private Sub TextBox1_KeyPress(....
   ListBox1.Items.Add(e.KeyChar)
   If  e.KeyChar = "P"  Then
       e.Handled = True
   End If
End Sub


Private Sub Form1_KeyUp(....
   If  e.KeyCode = Keys.R  Then
       If   e.Alt  And  e.Shift  Then
            me.BackColor = Color.FromKnownColor( KnownColor.Control )
       ElseIf  e.Alt  Then
            me.BackColor = Color.Red
       End If
   End If
End Sub



0 件のコメント:

コメントを投稿