社区
C#
帖子详情
触发ImageButton
zhengmushang
2008-12-05 11:46:29
一个页面有两个ImageButton,分别是ImageButton1、ImageButton2
还有两个TextBox,分别是TextBox1和TextBox。
现在需要鼠标在TextBox1的时候,按回车,触发ImageButton1。
鼠标在TextBox2的时候,按回车,触发ImageButton2。
请问该如何写代码。
...全文
131
9
打赏
收藏
触发ImageButton
一个页面有两个ImageButton,分别是ImageButton1、ImageButton2 还有两个TextBox,分别是TextBox1和TextBox。 现在需要鼠标在TextBox1的时候,按回车,触发ImageButton1。 鼠标在TextBox2的时候,按回车,触发ImageButton2。 请问该如何写代码。
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
9 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
birdlonger
2008-12-05
打赏
举报
回复
private void 用户密码TextBox_KeyPress(object sender, KeyPressEventArgs e) //lele use "Enter" login .12.05
{
if (e.KeyChar == 13)
{
登录系统Button_Click(this, e); //这里引发Click事件.
}
}
这是我在一个登录界面里面写的...你抄写下就可以了
wesleyluo
2008-12-05
打赏
举报
回复
private void Textbox_Keypress( objectsender,KeyEventArgs e)
{
if(e.keycode==keycode.enter)
{
你要执行的动作,显示imagebutton等等。
imagebutton.visable=true;
}
}
如果你要执行其他的方法,自己写上去就可以了。
zgke
2008-12-05
打赏
举报
回复
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if(sender==null)return;
if (e.KeyChar == '\r')
{
Control _Temp =(Control)sender;
switch (_Temp.Name)
{
case "TextBox1":
ImageButton1_Click(null, null);
break;
case "TextBox2":
ImageButton2_Click(null, null);
break;
default:
break;
}
}
}
huiweichi
2008-12-05
打赏
举报
回复
textBox的keyDown事件
{
if (e.KeyCode == Keys.Enter)
{
ImageButton想要执行的操作
}
}
topglorylines
2008-12-05
打赏
举报
回复
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
ImageButton1.PerformClick()
}
}
HDNGO
2008-12-05
打赏
举报
回复
早晨问过的吧。。貌似有答案了~
tianshangfei
2008-12-05
打赏
举报
回复
oo
dq512000
2008-12-05
打赏
举报
回复
TextBox1.Attributes.Add("onkeypress", "testEnterKey();");
客户端脚本
zhengmushang
2008-12-05
打赏
举报
回复
我的是webform不是winform。
android
imagebutton
点击变化 源码
android
imagebutton
点击变化 源码
Imagebutton
NULL 博文链接:https://skyline888.iteye.com/blog/761575
Android自定义
ImageButton
(带文字)
Android自定义view,实现带文字的
ImageButton
ImageButton
控件
ImageButton
控件,继承自System.Windows.Forms.Button
wpf
ImageButton
图片按钮,按钮里的图片文字,可以水平排列,垂直排列;可以更改图片,文字内容及按钮背景色
C#
111,131
社区成员
642,542
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章