Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace WindowsFormsApplication7
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- }
- private void button1_Keydown(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == Keys.W)
- {
- if (button1.Location.Y + button1.Height < ClientSize.Height)
- {
- button1.Location = new System.Drawing.Point(button1.Location.X, button1.Location.Y - 20);
- }
- }
- if (e.KeyCode == Keys.S)
- {
- if (button1.Location.Y + button1.Height < ClientSize.Height)
- {
- button1.Location = new System.Drawing.Point(button1.Location.X, button1.Location.Y + 20);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement