How To Use Key Char And Key Code In C#
How To Use Key Char And Key Code In C#
Project Source Code:
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 WindowsFormsApplication1
{
public partial class Csharp_keycode_keychar : Form
{
public Csharp_keycode_keychar()
{
InitializeComponent();
}
// keycode
private void Csharp_keycode_keychar_KeyDown(object sender, KeyEventArgs e)
{
if ((e.KeyCode == Keys.Enter) && e.Control)
label1.Text = "CONTROL + ENTER";
else
label1.Text = "/////";
}
// keychar
private void Csharp_keycode_keychar_KeyPress(object sender, KeyPressEventArgs e)
{
if(e.KeyChar == (char)Keys.Space)
label1.Text = "spacebar";
else
label1.Text = "/////";
}
}
}
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 WindowsFormsApplication1
{
public partial class Csharp_keycode_keychar : Form
{
public Csharp_keycode_keychar()
{
InitializeComponent();
}
// keycode
private void Csharp_keycode_keychar_KeyDown(object sender, KeyEventArgs e)
{
if ((e.KeyCode == Keys.Enter) && e.Control)
label1.Text = "CONTROL + ENTER";
else
label1.Text = "/////";
}
// keychar
private void Csharp_keycode_keychar_KeyPress(object sender, KeyPressEventArgs e)
{
if(e.KeyChar == (char)Keys.Space)
label1.Text = "spacebar";
else
label1.Text = "/////";
}
}
}
اشترك في بريدنا الالكتروني لتتوصل باشعار فور نشر موضوع جديد
0 الرد على "How To Use Key Char And Key Code In C#"
إرسال تعليق