110,590
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Windows.Forms;
class Form1 : Form
{
Form1()
{
TextBox tbx = new TextBox();
tbx.Parent = this;
tbx.KeyDown += delegate(object o, KeyEventArgs e)
{
if(e.Alt && e.KeyCode == Keys.F1) // 组合键 Alt-F1
{
SendKeys.Send("{1}{ADD}{2}"); // 变成 1+2
e.Handled = true;
}
};
}
static void Main()
{
Application.Run(new Form1());
}
}
using System;
using System.Windows.Forms;
class Form1 : Form
{
Form1()
{
TextBox tbx = new TextBox();
tbx.Parent = this;
tbx.KeyPress += delegate(object o, KeyPressEventArgs e)
{
++e.KeyChar; // 这样的话,A -> B, B -> C, etc...
};
}
static void Main()
{
Application.Run(new Form1());
}
}
using System;
using System.Windows.Forms;
class Form1 : Form
{
Form1()
{
TextBox tbx = new TextBox();
tbx.Parent = this;
tbx.KeyPress += delegate(object o, KeyPressEventArgs e)
{
if (e.KeyChar == 'A') e.KeyChar = 'B';
};
}
static void Main()
{
Application.Run(new Form1());
}
}