Merhaba arkadaşlar, Formumuzun Keydown yordamına yazacağımız kodla F10 tuşuna basarak formumuzu kapatacağız.
Form1.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.KeyDown += new KeyEventHandler(Form1_KeyDown);
}
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.F10)
{
this.Close();
}
}
}
}
0 comments:
Yorum Gönder