| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 737 人关注过本帖
标题:怎么给toolBarButton添加事件代码
只看楼主 加入收藏
solomon
Rank: 1
等 级:新手上路
帖 子:22
专家分:0
注 册:2006-5-22
收藏
 问题点数:0 回复次数:2 
怎么给toolBarButton添加事件代码
我在toolBar添加了4个toolBarButton 请问怎么给每个按钮添加按下时的时间处理代码
搜索更多相关主题的帖子: 代码 
2006-06-24 23:23
linsoo
Rank: 1
等 级:新手上路
帖 子:61
专家分:0
注 册:2006-4-29
收藏
得分:0 

双击toolBar会自动生成这样的代码
private void toolBar_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
{

}
然后你可以switch (e.Button)
case this.buttonxxxx;

buttionxxxx就是你toolbar里面定义的按钮
2006-06-25 18:52
TrulyXu
Rank: 1
等 级:新手上路
帖 子:34
专家分:0
注 册:2006-6-9
收藏
得分:0 
比如这四个按钮:tlbAdd,tlbEdit,tlbSave,tlbDelete
private void toolBar_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
{
if(e.Button.Text == tlbAdd.text)
{

}
else if(e.Button.Text == tlbEdit.Text)
{
}
...
}
即可.
2006-06-25 20:09
快速回复:怎么给toolBarButton添加事件代码
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011142 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved