• 31-12-2010, 01:35:51
    #1
    Üyeliği durduruldu
    Merhabalar. Klavyedeki yön oklarıyla butonu nasıl hareket ettirebilirim?
  • 31-12-2010, 02:07:31
    #2
    Kimlik doğrulama veya yönetimden onay bekliyor.
    Merhaba.Uyumadan önce yazıyım dedim
    Aşağıda yapılabilecek yöntemlerden birini yazdım. Umarım işine yarar.

    protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
            {
    
                bool b = false;
    
                switch (keyData)
                {
    
                    case Keys.Left:
                        Guncelle(-1, 0);
                        break;
    
                    case Keys.Right:
                        Guncelle(+1, 0);
                        break;
    
                    case Keys.Up:
                        Guncelle(0, -1);
                        break;
    
                    case Keys.Down:
                        Guncelle(0, +1);
                        break;
                    default:
                        break;
    
               }
    
                return b;
    
            }
            void Guncelle(int x, int y)
            {
                Point p = new Point(button1.Location.X+x,button1.Location.Y+y);
                button1.Location = p;
            }
  • 31-12-2010, 02:15:49
    #3
    private void Form12_KeyDown(object sender, KeyEventArgs e)
            {
                ProcessDialogKey(Keys.KeyCode);
            }
    
            protected override bool ProcessDialogKey(Keys keyData)
            {
                if (keyData == Keys.Up)
                {
                    button1.Location = new Point(button1.Location.X, button1.Location.Y - 50);
                }
    
                if (keyData == Keys.Left)
                {
                    button1.Location = new Point(button1.Location.X - 50, button1.Location.Y);
                }
    
                if (keyData == Keys.Down)
                {
                    button1.Location = new Point(button1.Location.X, button1.Location.Y +50);
                }
    
                if (keyData == Keys.Right)
                {
                    button1.Location = new Point(button1.Location.X + 50, button1.Location.Y);
                }
    
                return base.ProcessDialogKey(keyData);
            }
  • 31-12-2010, 02:23:21
    #4
    Üyeliği durduruldu
    Teşekkürler. ALLAH ikinizdende razı olsun.