using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.WindowsCE.Forms;

namespace HardwareButton_CS
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            #if DEBUG
                MinimizeBox = false;
            #else
                MinimizeBox = true;
            #endif
        }

        HardwareButton _but1;

        private void Form1_Load(object sender, EventArgs e)
        {
            _but1 = new HardwareButton();
 
            _but1.AssociatedControl = this;
 
            _but1.HardwareKey = HardwareKeys.ApplicationKey2;
         }
        
        private void Form1_KeyUp(object sender, KeyEventArgs e)
        {
            switch ((HardwareKeys)e.KeyCode)
            {
                case HardwareKeys.ApplicationKey2:
                    MessageBox.Show("Вы нажали на кнопку");
                     break;
                 default:
                    break;
            }
        }
    }
}