通过设置窗体的AcceptButton属性,可以设置窗体的“接受”按钮,若此设计,则用户每次按下Enter键都相当于单击该按钮

王朝学院·作者佚名  2016-08-28
窄屏简体版  字體: 小  |  中  |  大  |  超大  

1usingSystem;2usingSystem.Collections.Generic;3usingSystem.ComponentModel;4usingSystem.Data;5usingSystem.Drawing;6usingSystem.Text;7usingSystem.Windows.Forms;89namespaceTest0210{11publicpartialclassForm1 : Form12{13publicForm1()14{15InitializeComponent();16}1718PRivatevoidForm1_Load(objectsender, EventArgs e)19{20this.AcceptButton =button1;21}2223privatevoidbutton1_Click(objectsender, EventArgs e)24{25MessageBox.Show("引发了接受按钮");26}27}28}

 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
© 2005- 王朝網路 版權所有 導航