AalborgHTX

Eventhandlere

Feb 12th, 2019
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.07 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace WindowsFormsApplication9
  12. {
  13.     public partial class Form1 : Form
  14.     {
  15.         public Form1()
  16.         {
  17.             InitializeComponent();
  18.         }
  19.  
  20.         private void button1_Click(object sender, EventArgs e)
  21.         {
  22.             MessageBox.Show(e.ToString());
  23.         }
  24.  
  25.         private void Form1_Load(object sender, EventArgs e)
  26.         {
  27.  
  28.         }
  29.  
  30.         private void button2_MouseDown(object sender, MouseEventArgs e)
  31.         {
  32.             if (e.Button == MouseButtons.Left) MessageBox.Show("DU ER VENSTREORIENTERET");
  33.             if (e.Button == MouseButtons.Right) MessageBox.Show("Du er DF");
  34.         }
  35.  
  36.         private void button2_KeyDown(object sender, KeyEventArgs e)
  37.         {
  38.             if (e.KeyData == Keys.A) button2.Location = new Point(button2.Location.X - 20, button2.Location.Y);
  39.         }
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment