按钮退格代码 [英] code for button backspace

查看:103
本文介绍了按钮退格代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hai,任何人都可以告诉我什么是按钮退格的代码.
目前,我正在创建项目科学计算器.在这个项目中,我需要为退格键准备一个按钮名称.哦,是的,我正在使用VS 2005 ..
tq

Hai , anyone can inform to me what is code for button backspace.
currently i am create project Scientific calculator. In this project i need to prepare a button name for backspace. Oh , ya i am using VS 2005 ..
tq

推荐答案

退格的Ascii是08.

但是对于计算器,您需要从右侧进行修剪.

假设您的处理程序的按钮退格为

Ascii of backspace is 08.

but for calculator you need to trim from right.

Say your handler for the button backspace is

Private void backSpace_Click(object sender, EventArgs e)
{
string str=textBox.Text;
int len;
len=str.Length;
textBox.Text="";

textBox.Text= str.Substring(0, len - 1)

}



textBox 是数字在计算器中出现的文本框.



The textBox is the textbox where the numbers appears in the calculator.


在事件处理程序中使用 e.Keys == Keys.Back.
Use e.Keys == Keys.Back in you event handler.


这篇关于按钮退格代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆