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. Linux编译安装源码包的流程

    流程: 1.  下载并解压源码包2.  运行:configure3.  编译:make4.  安装:make install 编译时需要注意一个原则:不要在解压的包中直接执行./configure.m ...

  2. 生产环境使用 pt-table-checksum 检查MySQL数据一致性

    公司数据中心从托管机房迁移到阿里云,需要对mysql迁移(Replication)后的数据一致性进行校验,但又不能对生产环境使用造成影响,pt-table-checksum 成为了绝佳也是唯一的检查工 ...

  3. 通过trie树单词自动补全(二)

    经常使用iciba进行单词查询, 关于他的搜索建议是通过单词前缀做的索引, 所以自己想动手实现下, 当然如果借助mysql的话,一条sql语句就能实现, 网上查询了下trie正适合做这个,所以通过C语 ...

  4. Centos6 服务器病毒查杀命令历史

    top whereis vhowazeclu ll /usr/bin/v* more /usr/bin/vhowazeclu ps aux|grep vhowa ps aux|grep vhowaze ...

  5. java多线程系类:JUC原子类:04之AtomicReference原子类

    概要 本章对AtomicReference引用类型的原子类进行介绍.内容包括:AtomicReference介绍和函数列表AtomicReference源码分析(基于JDK1.7.0_40)Atomi ...

  6. C#.NET 大型企业信息化系统集成快速开发平台 4.2 版本 - 大型软件系统客户端数据同步的问题解决

    作为一个完整的整体信息化解决方案需要有足够强大的各种功能,这些功能相对独立,又互相依存.当有需要这样的功能时可以随时拿出来用,适当修改一下就可以满足要求.只有这样才能快速开发各种信息化系统,才能满足各 ...

  7. rpc框架之 thrift连接池实现

    接前一篇rpc框架之HA/负载均衡构架设计 继续,写了一个简单的thrift 连接池: 先做点准备工作: package yjmyzz; public class ServerInfo { publi ...

  8. java并发编程学习:如何等待多个线程执行完成后再继续后续处理(synchronized、join、FutureTask、CyclicBarrier)

    多线程应用中,经常会遇到这种场景:后面的处理,依赖前面的N个线程的处理结果,必须等前面的线程执行完毕后,后面的代码才允许执行. 在我不知道CyclicBarrier之前,最容易想到的就是放置一个公用的 ...

  9. 【笔记3】用pandas实现矩阵数据格式的推荐算法 (基于用户的协同)

    原书作者使用字典dict实现推荐算法,并且惊叹于18行代码实现了向量的余弦夹角公式. 我用pandas实现相同的公式只要3行. 特别说明:本篇笔记是针对矩阵数据,下篇笔记是针对条目数据. ''' 基于 ...

  10. IDEA 和 Eclipse 使用对比

    前段时间从 Eclipse 中将开发工作转移到了 IDEA. IDEA 确实有很多地方比 Eclipse 做的好,总结了一些 IDEA 和 Eclipse 的不同. 1.文件和导航关联 经常需要打开某 ...