Skip to content

Instantly share code, notes, and snippets.

@masaru-b-cl
Created April 26, 2012 08:20
Show Gist options
  • Save masaru-b-cl/2497559 to your computer and use it in GitHub Desktop.
Save masaru-b-cl/2497559 to your computer and use it in GitHub Desktop.
WinFormsにて、ファンクションキーの既定の動作を握りつぶす方法
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();
}
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
if (Keys.F1 <= e.KeyCode && e.KeyCode <= Keys.F12)
{
this.Text = e.KeyCode.ToString() + " Pressed!";
// ファンクションキーの基底の動作を握り潰す
e.Handled = true;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment