ContextMenuStrip

  添加控件后可在其他空间属性中进行绑定


MenuStrip
       设置热键:在编辑的时候输入(&F)
       设置快捷键:选中菜单项--右键属性--ShortCutKeys--设置快捷键
       设置分隔线:在输入的时候输入减号(-)


StatusStrip
       状态栏,可以添加按钮,文本等


ToolStrip
       在ToolStripContainer控件内可被拖动修改位置


ToolStripContainer
       帮助ToolStrip布局控件


计算器

/// <summary>
        /// 根据点击的控件输入数字
        /// </summary>
        /// <param name="e"></param>
        private void shuru(string str)
        {
            "||qk){
                textBox1.Text = str;
                qk = false;
            }
            else
                textBox1.Text += str;
        }
        /// <summary>
        /// 输入数字
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void b0_Click(object sender, EventArgs e)
        {
            shuru((sender as Control).Text);
        }
        /// <summary>
        /// 小数点
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dian_Click(object sender, EventArgs e)
        {
            if(!textBox1.Text.Contains("."))
                textBox1.Text+=".";
        }
        /// <summary>
        /// 退格
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void back_Click(object sender, EventArgs e)
        {
            )
                textBox1.Text = ";
            else
                textBox1.Text = textBox1.Text.Substring(, textBox1.TextLength-);
        }
        /// <summary>
        /// 根据按下的按键键入计算符号
        /// </summary>
        /// <param name="e"></param>
        private void jis(string str)
        {
            if (qk) {
                if (shang != str) {
                    textBox2.Text = textBox2.Text.Substring(, textBox2.TextLength - ) + str;
                    shang = str;
                }
            }
            else
            {
                qk = true;
                dq = Convert.ToDecimal(textBox1.Text);
                if (textBox2.Text == "")
                {
                    jieguo = Convert.ToDecimal(textBox1.Text);
                    textBox2.Text = textBox1.Text + str;
                    shang = str;
                }
                else
                {
                    js();
                    )
                        textBox2.Text += textBox1.Text + str;
                    else
                        textBox2.Text += "(" + textBox1.Text + ")" + str;
                    textBox1.Text = jieguo.ToString();
                    shang = str;
                }
            }
        }
        //标记是否点击运算符号
        bool qk = false;
        //保存结果
        ;
        ;
        //上一步操作
        string shang = "";
        /// <summary>
        /// 运算符操作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void jia_Click(object sender, EventArgs e)
        {
            jis((sender as Control).Text);
        }
        /// <summary>
        /// 根据上一次运算符操作
        /// </summary>
        private void js()
        {
            try {
            switch(shang)
            {
                case "+":
                    jieguo = jieguo + dq;
                    break;
                case "-":
                    jieguo = jieguo - dq;
                    break;
                case "*":
                    jieguo = jieguo * dq;
                    break;
                case "/":
                    jieguo = jieguo / dq;
                    break;
            }

            }
            "; }
        }
        /// <summary>
        /// 等号
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button20_Click(object sender, EventArgs e)
        {
            js();
            textBox2.Text = "";
            textBox1.Text = jieguo.ToString();
        }

        private void button20_KeyPress(object sender, KeyPressEventArgs e)
        {
            switch(e.KeyChar)
            {
                case '.':
                    if (!textBox1.Text.Contains("."))
                        textBox1.Text += ".";
                    break;
                case (char)Keys.Back:
                    )
                        textBox1.Text = ";
                    else
                        textBox1.Text = textBox1.Text.Substring(, textBox1.TextLength - );
                    break;
                :
                    js();
                    textBox2.Text = "";
                    textBox1.Text = jieguo.ToString();
                    break;
                ':
                    shuru(");
                    break;
                ':
                    shuru(");
                    break;
                ':
                    shuru(");
                    break;
                ':
                    shuru(");
                    break;
                ':
                    shuru(");
                    break;
                ':
                    shuru(");
                    break;
                ':
                    shuru(");
                    break;
                ':
                    shuru(");
                    break;
                ':
                    shuru(");
                    break;
                ':
                    shuru(");
                    break;
                case '+':
                    jis("+");
                    break;
                case '-':
                    jis("-");
                    break;
                case '*':
                    jis("*");
                    break;
                case '/':
                    jis("/");
                    break;
            }
        }

        private void button3_Click(object sender, EventArgs e)
        {
            textBox1.Text = textBox2.Text = "";
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {
            textBox1.SelectionStart = textBox1.Text.Length;
            textBox2.SelectionStart = textBox2.Text.Length;
        }

        private void button4_Click(object sender, EventArgs e)
        {
            textBox1.SelectionStart = textBox1.Text.Length;
        }

一版

WindowsForm菜单工具栏--2016年12月6日的更多相关文章

  1. 2016年12月31日 星期六 --出埃及记 Exodus 21:26

    2016年12月31日 星期六 --出埃及记 Exodus 21:26 "If a man hits a manservant or maidservant in the eye and d ...

  2. 2016年12月30日 星期五 --出埃及记 Exodus 21:25

    2016年12月30日 星期五 --出埃及记 Exodus 21:25 burn for burn, wound for wound, bruise for bruise.以烙还烙,以伤还伤,以打还打 ...

  3. 2016年12月29日 星期四 --出埃及记 Exodus 21:24

    2016年12月29日 星期四 --出埃及记 Exodus 21:24 eye for eye, tooth for tooth, hand for hand, foot for foot,以眼还眼, ...

  4. 2016年12月28日 星期三 --出埃及记 Exodus 21:23

    2016年12月28日 星期三 --出埃及记 Exodus 21:23 But if there is serious injury, you are to take life for life,若有 ...

  5. 2016年12月27日 星期二 --出埃及记 Exodus 21:22

    2016年12月27日 星期二 --出埃及记 Exodus 21:22 "If men who are fighting hit a pregnant woman and she gives ...

  6. c++中变量声明和变量定义的区别。2016年12月6日

    整个流程: 1.程序告诉cpu,程序将要使用一个变量.(暂时不一定用到,先说一下.) 2.程序告诉CPU,程序现在就要使用一个变量.(现在就用) 3.cpu按照这个变量的类型,把内存划分出几个单位(b ...

  7. 2016年12月26日 星期一 --出埃及记 Exodus 21:21

    2016年12月26日 星期一 --出埃及记 Exodus 21:21 but he is not to be punished if the slave gets up after a day or ...

  8. 2016年12月25日 星期日 --出埃及记 Exodus 21:20

    2016年12月25日 星期日 --出埃及记 Exodus 21:20 "If a man beats his male or female slave with a rod and the ...

  9. 2016年12月24日 星期六 --出埃及记 Exodus 21:19

    2016年12月24日 星期六 --出埃及记 Exodus 21:19 the one who struck the blow will not be held responsible if the ...

随机推荐

  1. [CareerCup] 1.1 Unique Characters of a String 字符串中不同的字符

    1.1 Implement an algorithm to determine if a string has all unique characters. What if you cannot us ...

  2. Apache 80无法启动

    netstat -abno后查看,经过查找为pid=4的system进程,因为是系统进程,也无法结束它,经查SQL Server ReportingServices (SQLEXPRESS) 服务占用 ...

  3. cogs 577 蝗灾 CDQ分治

    第一道CDQ,抄了下helenkeller的代码,感觉和归并排序差不多... 因为左半边的修改肯定在右半边的询问之前,所以就不用管时间的限制了,可以直接x轴排序树状数组处理y轴... #include ...

  4. Hadoop中pid文件存储

    我的hadoop集群部署在自己电脑虚拟机上,有时候我是挂起虚拟机,第二天再打开发现有些线程就挂了,比如namenode,好奇怪,当时看了一些帖子说是和pid存储有关,找到log看到找不到pid.因为基 ...

  5. mogodb3.2源码安装

    mogodb3.2源码安装 下载链接: http://www.mongodb.org/downloads 1.环境准备: 1.mkdir -p /data/tgz #创建存放软件的目录 2.mkdir ...

  6. 对前端的一个H5项目的所思所想

    最近接触一个前端HTML5的项目,虽然我主做iOS,但曾经也徒手用html+css+js+php写过一个博客,当然表示无压力了.结果.现在的前端发展的速度真是快啊,项目中用到Jquery,reactJ ...

  7. PDFobject插件使用,PDF在线查看插件

    1.引入插件JS <script type="text/javascript" src="PDFobject.js"></script> ...

  8. <<< Java提取网页源码

    package com.sevennight; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io ...

  9. Raspberry Pi 3 --- GPIO control

    Before input 'gpio readall', need install wiringPi download "wiringPi":git clone git://git ...

  10. RabbitMQ消息队列(一): Detailed Introduction 详细介绍

     http://blog.csdn.net/anzhsoft/article/details/19563091 RabbitMQ消息队列(一): Detailed Introduction 详细介绍 ...