• Button,CheckBox,Lable,RadioButton,ComboBox,TextBox六个简单控件的使用


    所有文字的更改全部在Text属性中更改!

    ComboBox:点击右上方小箭头,选择编辑项弹出:

      

    RadioButton:,Checked属性选择True,表示已被选中;

    Button:在设计中双击按钮跳转到代码区,代码中会增加如下代码:

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    
    namespace _6个简单控件_肯德基点餐
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
                //主食索引默认为0
                comboBox1.SelectedIndex = 0;
            }
    
            private void Form1_Load(object sender, EventArgs e)
            {
    
            }
    
            private void radioButton1_CheckedChanged(object sender, EventArgs e)
            {
    
            }
    
            private void radioButton3_CheckedChanged(object sender, EventArgs e)
            {
    
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
                //选取主食
                string zs = comboBox1.SelectedItem.ToString();
                //选取配菜
                string pc="";
                if (radioButton1.Checked)//选中的是薯条
                    pc = "薯条";
                else if(radioButton2.Checked)//选中的是土豆泥
                    pc="土豆泥";
                else//选中的是玉米棒
                    pc = "玉米棒";
                //选取饮品
                string yp = "";
                if (checkBox1.Checked)//选中可乐
                {
                    yp += checkBox1.Text;
                    if (checkBox2.Checked)//选中可乐,咖啡
                    {
                        yp =yp +"," + checkBox2.Text;
                        if (checkBox3.Checked)//选中可乐,咖啡,橙汁
                        {
                            yp =yp+ "," + checkBox3.Text;
    
                        }
                    }
                    if (checkBox3.Checked)//选中可乐,橙汁
                    {
                        yp = yp + "," + checkBox3.Text;
    
                    }
    
                }
                else if (checkBox2.Checked)//选中咖啡
                {
                    yp += checkBox2.Text;
                    if (checkBox3.Checked)//选中咖啡,橙汁
                    {
                        yp =yp+ "," + checkBox3.Text;
    
                    }
                }
                else//只选中橙汁
                {
                    yp += checkBox3.Text;
                }
    
                //获取地址
                string dz = textBox1.Text;
                //获取电话
                string dh = textBox2.Text;
                //弹出消息框
                MessageBox.Show("您选取的主食是:"+zs+"
    配菜是:"+pc+"
    饮品是:"+yp+"
    配送地址:"+dz+"
    联系方式:"+dh);
            }
        }
    }

    点击下单弹出:

  • 相关阅读:
    python daemon install
    添加 sudoer centos
    CentOS 5安装openssh
    java使用sh或是jsvc来做daemon应该是主流
    Maven JAR Plugin
    The Java™ Tutorials offical学习的好资料哦
    linux下lrzsz安装,SecureCRT上传下载文件工具 寒枫欣叶
    ssh on centos5
    CentOS Linux Install Core Development Tools Automake, Gcc (C/C++), Perl, Python & Debuggers
    Setting an Application's Entry Point
  • 原文地址:https://www.cnblogs.com/maxin991025-/p/6132263.html
Copyright © 2020-2023  润新知