WindowsForm菜单工具栏--2016年12月6日
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日的更多相关文章
- 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 ...
- 2016年12月30日 星期五 --出埃及记 Exodus 21:25
2016年12月30日 星期五 --出埃及记 Exodus 21:25 burn for burn, wound for wound, bruise for bruise.以烙还烙,以伤还伤,以打还打 ...
- 2016年12月29日 星期四 --出埃及记 Exodus 21:24
2016年12月29日 星期四 --出埃及记 Exodus 21:24 eye for eye, tooth for tooth, hand for hand, foot for foot,以眼还眼, ...
- 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,若有 ...
- 2016年12月27日 星期二 --出埃及记 Exodus 21:22
2016年12月27日 星期二 --出埃及记 Exodus 21:22 "If men who are fighting hit a pregnant woman and she gives ...
- c++中变量声明和变量定义的区别。2016年12月6日
整个流程: 1.程序告诉cpu,程序将要使用一个变量.(暂时不一定用到,先说一下.) 2.程序告诉CPU,程序现在就要使用一个变量.(现在就用) 3.cpu按照这个变量的类型,把内存划分出几个单位(b ...
- 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 ...
- 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 ...
- 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 ...
随机推荐
- Map接口,Map.Entry,hashMap类,TreeMap类,WeakHashMap。
Collection接口之前接触过,每次保存的对象是一个对象,但是在map中保存的是一对对象,是以key->value形式保存的. 定义: public interface Map<K,V ...
- C#.NET 大型通用信息化系统集成快速开发平台 4.1 版本 - 角色成员功能的改进支持公司加入到角色
我们公司有1万多个网点,每个网点都可以看成是一个公司,公司对不同的网点有不同的策略,商业逻辑,每个网点的人员也都是在不断变化,全国有接近10万从业人员,当我们设计好业务逻辑程序后,不可能因为这些人员的 ...
- 为普通Object添加类似AttachedProperty的属性
为普通Object添加类似AttachedProperty的属性 周银辉 我们知道,在WPF中对应一个DependencyObject,我们很容易通过AttachedProperty来为类型附加一 ...
- haproxy 新手上路
apache.nginx之类的反向代理(转发)功能,通常只能用于http协议,其它协议就不好使了(注:nginx据说商业版的,支持tcp协议了). haproxy可以弥补这方面的不足,haproxy支 ...
- [[其他教程]] 2015年最新版iOS基础视频_最适合初学者入门
主讲:孙庆虎类型:iOS 适合对象:初学者入门视频介绍:本视频是iOS学院精心录制的免费精华版iOS语言基础视频,该视频特点在于最大程度保证了知识点的完整性,按知识点进行视频录制,每个视频控制在20分 ...
- ajax返回值中有回车换行、空格的解决方法分享
最近在写一个页面,用jquery ajax来实现判断,刚写好测试完全没有问题,过了两天发现出现问题,判断不成了.后来发现所有alert出来的返回值前面都会加若干换行和空格.(至今不明白,同一台电脑,同 ...
- knockoutJS学习笔记07:绑定上下文
所谓绑定上下文就是当前绑定(dat-bind)所使用到的对象(ViewModel).在单个对象绑定的情况下是很容易理解的,但对象可能是复杂的类型,嵌套很多层,这个时候每层都有自己的上下文对象,理解起来 ...
- 【平面设计AFTER】读到的设计海报分层法
来源参考:http://www.uisdc.com/graphic-designer-self-improvement 分层法的三层:“背景层”,“图形层”,“信息层” 1,背景层,一般为纯色,场景, ...
- linux基础知识与技能3
3.2.vi的高级使用* 查找在命令模式下,输入/xxx,就可以查找到xxx * 快速切换行在命令模式下,输入:num,就可以快速切换到num行 * 设置显示行号在命令模式下,输入:set nu,就可 ...
- 分布式缓存Redis使用心得
一.缓存在系统中用来做什么 1. 少量数据存储,高速读写访问.通过数据全部in-momery 的方式来保证高速访问,同时提供数据落地的功能,实际这正是Redis最主要的适用场景. 2. 海量数据存储, ...