Vbde tuşlara basarak buttonun boyutunu değiştiren program ?

09/12/2010, 21:34

Şeyma462

Alt tuşuyla birlikte yön tuşlarına basıldığında formdaki buttonun boyutu değişen,
Ctrl tuşuyla yön tuşlarına basıldığında formdaki bileşenleri hareket ettiren,
F2 tuşuna basılınca formun adı o anki saat olan programın kodunu nasıl yazmalıyım?
13/12/2010, 13:37

Coskun0559

'butona 1 adet buton ekle ve kodları yapıştır.
Private Sub Command1_KeyDown(KeyCode As Integer, Shift As Integer)
'(buradaki kodlar alt tuşu ile birlikte yön tuşlarına basarsan
' butonunu sağa sola hareket ettirir)
If KeyCode = vbKeyRight And Shift = 4 Then
Command1.Width = Command1.Width + 50 'alt tuşu ile sağ yön tuşu butonu sağa doğru büyütür
End If
If KeyCode = vbKeyLeft And Shift = 4 Then
Command1.Width = Command1.Width - 50 'alt tuşu ile sağ yön tuşu butonu sola doğru küçültür
End If
If KeyCode = vbKeyUp And Shift = 4 Then
Command1.Width = Command1.Height + 500
End If
If KeyCode = vbKeyDown And Shift = 4 Then
Command1.Width = Command1.Height - 500
End If
' şimdi ctrl tuşlarıyla butonu hareket ettirelim ctrl tuşu ile yön tuşlarına bas
If KeyCode = vbKeyRight And Shift = 2 Then
Command1.Left = Command1.Left + 500
End If
If KeyCode = vbKeyLeft And Shift = 2 Then
Command1.Left = Command1.Left - 500
End If
If KeyCode = vbKeyUp And Shift = 2 Then
Command1.Top = Command1.Top - 500
End If
If KeyCode = vbKeyDown And Shift = 2 Then
Command1.Top = Command1.Top + 500
End If
'bu kodda formun başlığını saat yapar
If KeyCode = vbKeyF2 Then
Form1.Caption = Time
End If
'bu kodda formun başlığını tarih yapar
If KeyCode = vbKeyF3 Then
Form1.Caption = Date
End If
End Sub
18/12/2010, 16:29

Şeyma462

Çok Teşekkür ederim.