最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 正文

C#复选按钮实例

来源:动视网 责编:小OO 时间:2025-09-28 00:20:10
文档

C#复选按钮实例

C#复选按钮实例作者:佚名  来源:中国自学编程网收集整理  发布日期:2008-12-17 一:在MicrosoftVisualStudio2005操作平台---新建项目---Windows应用程序---项目名称命名为CheckBoxClass,在工具栏拉一个label页签和四个checkBox。 二:窗体代码如下: usingSystem; usingSystem.Collections.Generic; usingSystem.ComponentModel; usingSystem.Da
推荐度:
导读C#复选按钮实例作者:佚名  来源:中国自学编程网收集整理  发布日期:2008-12-17 一:在MicrosoftVisualStudio2005操作平台---新建项目---Windows应用程序---项目名称命名为CheckBoxClass,在工具栏拉一个label页签和四个checkBox。 二:窗体代码如下: usingSystem; usingSystem.Collections.Generic; usingSystem.ComponentModel; usingSystem.Da

C#复选按钮实例

作者:佚名  来源:中国自学编程网收集整理   发布日期:2008-12-17  

一:在Microsoft Visual Studio 2005操作平台---新建项目---Windows应用程序---项目名称命名为CheckBoxClass,在工具栏拉一个label页签和四个checkBox。 

二:窗体代码如下: 

using System; 

using System.Collections.Generic; 

using System.ComponentModel; 

using System.Data; 

using System.Drawing; 

using System.Text; 

using System.Windows.Forms; 

namespace CheckBoxClass 

public partial class Form1 : Form 

public Form1() 

InitializeComponent(); 

private void checkBox1_CheckedChanged(object sender, EventArgs e) 

label1.Text = "选中的复选框:" + Stat(); 

private void checkBox2_CheckedChanged(object sender, EventArgs e) 

label1.Text = "选中的复选框:" + Stat(); 

private void checkBox3_CheckedChanged(object sender, EventArgs e) 

label1.Text = "选中的复选框:" + Stat(); 

private void checkBox4_CheckedChanged(object sender, EventArgs e) 

label1.Text = "选中的复选框:" + Stat(); 

private string Stat() 

if (checkBox1.Checked) 

if (checkBox2.Checked) 

if (checkBox3.Checked) 

if (checkBox4.Checked) 

return "1,2,3,4"; 

else 

return "1,2,3"; 

else 

if (checkBox4.Checked) 

return "1,2,4"; 

else 

return "1,2"; 

else 

if (checkBox3.Checked) 

if (checkBox4.Checked) 

return "1,3,4"; 

else 

return "1,3"; 

else 

if (checkBox4.Checked) 

return "1,4"; 

else 

return "1"; 

else 

if (checkBox2.Checked) 

if (checkBox3.Checked) 

if (checkBox4.Checked) 

return "2,3,4"; 

else 

return "2,3"; 

else 

if (checkBox4.Checked) 

return "2,4"; 

else 

return "2"; 

else 

if (checkBox3.Checked) 

if (checkBox4.Checked) 

return "3,4"; 

else 

return "3"; 

else 

if (checkBox4.Checked) 

return "4"; 

else 

return "无"; 

三:分别选中checkBox1、checkBox2、checkBox3、checkBox4在属性窗口CheckedChanged选择相应的事件。 

四:F5运行程序,分别选中checkBox2、checkBox3、checkBox4,label1。

文档

C#复选按钮实例

C#复选按钮实例作者:佚名  来源:中国自学编程网收集整理  发布日期:2008-12-17 一:在MicrosoftVisualStudio2005操作平台---新建项目---Windows应用程序---项目名称命名为CheckBoxClass,在工具栏拉一个label页签和四个checkBox。 二:窗体代码如下: usingSystem; usingSystem.Collections.Generic; usingSystem.ComponentModel; usingSystem.Da
推荐度:
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top