登录
首页 » C#源码 » C# 使用字符串数组创建一组单选框数据

C# 使用字符串数组创建一组单选框数据

于 2022-02-27 发布 文件大小:30.32 kB
0 192
下载积分: 2 下载次数: 1

代码说明:

C# 基于字符串数组创建一组单选按钮的例子,附上了例子源代码,大家可了解C#字符串数组的简单应用。   以下是例子中的代码,运行后可见如下图所示的图片效果:   //基于字符串数组创建一组单选按钮   string[] MyArray = new string[4];   MyArray[0] = "渝北区";   MyArray[1] = "巴南区";   MyArray[2] = "长寿区";   MyArray[3] = "南岸区";   RadioButton[] MyRadioButtons =new RadioButton[4];   for (int i = 0; i < 4; ++i)   {    MyRadioButtons[i] = new RadioButton();    MyRadioButtons[i].Text = MyArray[i];    MyRadioButtons[i].Location = new System.Drawing.Point(    10, 20 + i * 20);    this.groupBox1.Controls.Add(MyRadioButtons[i]);   }   this.groupBox1.Text = "请评选全市卫生城区:";

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • C#检查CheckBox控件是否被选中
    C#检查CheckBox复选框控件是否被选中,或者说是判断用户是否单击了checkbox按钮,可用于用户输入界面中,本示例提供了完整的复选框判断机制,有需要的可参考以下代码:   private void checkBox1_Click(object sender, EventArgs e)   {    if (checkBox1.CheckState == CheckState.Checked)    {    MessageBox.Show("CheckBox控件被选中");    }    else    {    MessageBox.Show("CheckBox控件选择被取消");    }   }
    2022-09-15 05:45:03下载
    积分:1
  • C#制作的WPF立体动画简单实例
    C#制作的WPF立体动画简单实例,像是一个太阳能电池版样子的立体动画,改变角度,是一个相当基础的WPF动画制作实例,运行效果请参见截图所示。
    2023-09-04 01:05:03下载
    积分:1
  • C# 从Uri指定的位置获取Cookie
    C# 从Uri指定的位置获取Cookie,获取当前WPF程序的Cookie数据,Cookie设置成功,请转到第二页面测试!
    2023-04-11 17:30:04下载
    积分:1
  • 程序守护(进程守护)-源代码C#
    程序守护(进程守护)-源代码C# /*  * 由SharpDevelop创建。  * 用户: zhang  * 日期: 2017/3/18  * 时间: 21:50  * 要改变这种模板请点击 工具|选项|代码编写|编辑标准头文件  */ using System; using System.Diagnostics; using System.Drawing; using System.Threading; using System.Windows.Forms; namespace CPinfoSafe { public sealed class NotificationIcon { private NotifyIcon notifyIcon; private ContextMenu notificationMenu; DialogResult dr; #region Initialize icon and menu public NotificationIcon() { notifyIcon = new NotifyIcon(); notificationMenu = new ContextMenu(InitializeMenu()); notifyIcon.DoubleClick += IconDoubleClick; System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(NotificationIcon)); notifyIcon.Icon = (Icon)resources.Get
    2022-11-01 19:35:03下载
    积分:1
  • igmp snooping源代码
    igmp snooping 实现源码,仅供参考。 非本人编写,从其它网站下载得来,仅供学习使用。如有侵权,请联系删除!
    2022-05-07 20:21:55下载
    积分:1
  • C# 使用COMPUTE BY 统计查询数据库中各部门工资
    C# COMPUTE BY数据库查询实例,本查询可用于统计各部门总工资,测试前请附加好数据库。定义以下代码完成此查询:   DataSet P_ds = GetPay();//得到数据集   txt_Pay1.Text = P_ds.Tables[1].Rows[0][0].ToString();//得到部门总工资   txt_Pay2.Text = P_ds.Tables[3].Rows[0][0].ToString();//得到部门总工资   txt_Pay3.Text = P_ds.Tables[5].Rows[0][0].ToString();//得到部门总工资   string P_Str_ConnectionStr = string.Format(//创建数据库连接字符串    @"server=LVSHUANGSHJ;database=db_TomeTwo;uid=sa;pwd=");   string P_Str_SqlStr = string.Format(//创建SQL查询字符串    "SELECT * FROM tb_Employee ORDER BY 所属部门 COMPUTE SUM(工资) BY 所属部门");//创建COMPUTE BY 查询语句   SqlDataAdapter P_SqlDataAdapter = new SqlDataAdapter(//创建数据适配器    P_Str_SqlStr, P_Str_ConnectionStr);   DataSet P_ds = new DataSet();//创建数据集   P_SqlDataAdapter.Fill(P_ds);//填充数据集   return P_ds;//返回数据集   本查询将结果返回DataTable到对象中显示,完整源代码请下载。
    2022-02-05 08:50:14下载
    积分:1
  • C# 将图像控件的定义导出为XAML文件
    C# 将图像控件的定义导出为XAML文件,支持的图像文件:图像文件(JPeg,Gif,Bmp,etc,tiff,png)等。   string MyXAML= System.Windows.Markup.XamlWriter.Save(this.image1);   if (System.IO.File.Exists("MyXaml.xaml"))    System.IO.File.Delete("MyXaml.xaml");   System.IO.File.AppendAllText("MyXaml.xaml", MyXAML);   MessageBox.Show(MyXAML, "MyXaml.xaml文件的内容", MessageBoxButton.OK);
    2022-04-14 09:51:54下载
    积分:1
  • 几个C# 窗口标题栏 按钮 任务栏自定义实例
    本源码主要是收集的几个C# 窗口标题栏 按钮 任务栏自定义实例,比如隐藏和显示标题栏、允许和禁止在窗口任务栏显示程序图标等,帮助C#初学者了解一些基础的C#窗口操作知识,有很好的学习参考价值。   private void button1_Click(object sender, RoutedEventArgs e)   {//隐藏标题栏    this.WindowStyle = System.Windows.WindowStyle.None;   }   private void button2_Click(object sender, RoutedEventArgs e)   {//显示标题栏    this.WindowStyle = System.Windows.WindowStyle.SingleBorderWindow;   }   private void button3_Click(object sender, RoutedEventArgs e)   {//禁止在任务栏上显示程序按钮    this.ShowInTaskbar = false;   }   private void button4_Click(object sender, RoutedEventArgs e)   {//允许在任务栏上显示程序按钮    this.ShowInTaskbar = true;   }   如下图所示,点击对应的按钮,可演示对应的功能。
    2023-03-24 21:30:03下载
    积分:1
  • activeMQ C++源码
    activeMQ C++源码 ,C++写的源代码,网上找到的,分享给大家。
    2022-09-14 21:05:04下载
    积分:1
  • C#在图片格式转换时设置JPEG压缩级别的实现源码
    C#在转换图像格式时设置JPEG压缩级别,运行程序在窗口上单击按钮后,会生成多个版本不同压缩级别的图片,图片大小字节都不一样,如下代码是实现本功能的核心代码:   Bitmap MyBitmap = new Bitmap(@"J001.jpg");   ImageCodecInfo MyDecoder = null;   ImageCodecInfo[] MyDecoders = ImageCodecInfo.GetImageDecoders();   foreach (ImageCodecInfo MyFormat in MyDecoders)   {    if (MyFormat.FormatID == ImageFormat.Jpeg.Guid)    {    MyDecoder = MyFormat;    }   }   System.Drawing.Imaging.Encoder MyEncoder =    System.Drawing.Imaging.Encoder.Quality;   EncoderParameters MyEncoderParameters = new EncoderParameters(1);   //以50中级压缩图像   EncoderParameter MyEncoderParameter = new EncoderParameter(MyEncoder, 50L);   MyEncoderParameters.Param[0] = MyEncoderParameter;   MyBitmap.Save("J50L.jpg", MyDecoder, MyEncoderParameters);   //以100高级压缩图像   MyEncoderParameter = new EncoderParameter(MyEncoder, 100L);   MyEncoderParameters.Param[0] = MyEncoderParameter;   MyBitmap.Save("J99L.jpg", MyDecoder, MyEncoderParameters);   //以0低级压缩图像   MyEncoderParameter = new Enc
    2022-05-18 00:19:47下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载