zoukankan      html  css  js  c++  java
  • 复选框选择变化(可以演化成简单的字符串拼接)

            //显示选中的文字
    private void showText(string title)
    {
    //定义空字符串
    string str = string.Empty;
    //以下确认该字符串的值
    if (checkBox1.Checked && !checkBox2.Checked)
    str = checkBox1.Text;
    if (checkBox2.Checked && !checkBox1.Checked)
    str = checkBox2.Text;
    if (checkBox1.Checked && checkBox2.Checked)
    str = checkBox1.Text + checkBox2.Text;
    //赋值给文本
    label1.Text = title + str;
    }

    //复选框1选择变化事件
    private void checkBox1_CheckedChanged(object sender, EventArgs e)
    {
    showText("你的爱好是:");

    }

    //复选框2选择变化事件
    private void checkBox2_CheckedChanged(object sender, EventArgs e)
    {
    showText("你的爱好是:");
    }


     

    code in my life.
  • 相关阅读:
    3.10 Go Map哈希表
    3.9 Go Slice切片
    3.8 Go Array数组
    3.7 Go指针
    3.6 Go String型
    3.5 Go布尔型
    3.4 Go字符型
    3.3 Go浮点型
    3.2 Go整数类型
    3.1Go变量
  • 原文地址:https://www.cnblogs.com/ghypnus/p/2415151.html
Copyright © 2011-2022 走看看