资源简介
自己做的一个软键盘,支持数字键盘和字母键盘,默认绑定的textbox,可以自己看情况进行修改.
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;
namespace TcKeyBoard
{
public partial class KeyBoard : Form
{
//private static Image capslock = null;
//private static Image shift = null;
//private static Image shiftcapslock = null;
//private static Image keyboard = null;
private static TextBox textBox1 = null;
public KeyBoard()
{
InitializeComponent();
}
private void Form1_Load(object sender EventArgs e)
{
try//加载背景图片
{
// Win32.AnimateWindow(this.Handle 500 Win32.AW_SLIDE + Win32.AW_VER_POSITIVE);
textBox1 = textBox2;
}
catch (Exception ex)//如果发生异常,则提示出错后关闭
{
MessageBox.Show(ex.Message “找不到图片“ MessageBoxButtons.OK MessageBoxIcon.Error);
this.Close();
}
}
private void button_MouseEnter(object sender EventArgs e)
{
Button button = sender as Button;
button.FlatAppearance.BorderSize = 2;
}
private void button_MouseLeave(object sender EventArgs e)
{
Button button = sender as Button;
button.FlatAppearance.BorderSize = 0;
}
private void button_MouseDown(object sender MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
Button button = sender as Button;
button.FlatAppearance.BorderSize = 0;
}
}
private void button_MouseUp(object sender MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
Button button = sender as Button;
button.FlatAppearance.BorderSize = 2;
}
}
private void button_Click(object sender EventArgs e)
{
Button button = sender as Button;
textBox1.Text += button.Tag;
textBox1.Selectionstart = textBox1.Text.Length;
textBox1.Select();
}
private void button48_Click(object sender EventArgs e)
{
if (textBox1.Text != ““)
{
textBox1.Text = textBox1.Text.Substring(0 textBox1.Text.Length - 1);
textBox1.Selectionstart = textBox1.Text.Length;
textBox1.Select();
}
}
private void letter_Up()
{
button1.Tag = “Q“;
button2.Tag = “W“;
button3.Tag = “E“;
button4.Tag = “R“;
button5.Tag = “T“;
button6.Tag = “Y“;
button7.Tag = “U“;
button8.Tag = “I“;
button9.Tag
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 10603 2017-02-09 17:29 TcKeyBoard\KeyBoard.cs
文件 90067 2017-02-04 13:34 TcKeyBoard\KeyBoard.designer.cs
文件 6186 2017-02-09 17:29 TcKeyBoard\KeyBoard.resx
文件 9650 2017-02-04 13:34 TcKeyBoard\NumberPad.cs
文件 23804 2017-02-04 13:34 TcKeyBoard\NumberPad.designer.cs
文件 6186 2017-02-04 13:34 TcKeyBoard\NumberPad.resx
文件 4026 2017-02-04 13:34 TcKeyBoard\TcKeyBoard.csproj
文件 1746 2017-02-04 13:34 TcKeyBoard\Textbox_FloatPad .cs
文件 1774 2017-02-04 13:34 TcKeyBoard\Textbox_IntPad .cs
目录 0 2017-04-19 23:11 TcKeyBoard
----------- --------- ---------- ----- ----
154042 10
评论
共有 条评论