来源:蜘蛛抓取(WebSpider)
时间:2016-05-31 15:57
标签:
visualstudio使用教程
君,已阅读到文档的结尾了呢~~
visual c#.NET程序设计应用第7章
扫扫二维码,随身浏览文档
手机或平板扫扫即可继续访问
visual c .NET程序设计应用第7章
举报该文档为侵权文档。
举报该文档含有违规或不良信息。
反馈该文档无法正常浏览。
举报该文档为重复文档。
推荐理由:
将文档分享至:
分享完整地址
文档地址:
粘贴到BBS或博客
flash地址:
支持嵌入FLASH地址的网站使用
html代码:
&embed src='/DocinViewer--144.swf' width='100%' height='600' type=application/x-shockwave-flash ALLOWFULLSCREEN='true' ALLOWSCRIPTACCESS='always'&&/embed&
450px*300px480px*400px650px*490px
支持嵌入HTML代码的网站使用
您的内容已经提交成功
您所提交的内容需要审核后才能发布,请您等待!
3秒自动关闭窗口前言:网上看的计算器制作只有代码,没有为全过程下面贴图,所以我在下面主要是贴图,让大家零基础制作计算器。我的环境是visual studio 2010,其他版本例如 都可以1.启动vs2010,新建-&项目,得到下图:2. 选择visual c#&-&windows-&Windows 窗体应用程序3.选择项目路径(不一定跟我的一样),名称尽量能让自己和别人明白。&&4.窗体Form1 就是我们即将要编辑的位置&&5.目前只用到button,textbox 控件,所以选择工具箱里的Button并拖到Form1编辑框里,TextBox也一样。&&6.按钮布局如下图,顶上是TextBox控件,下面是20个button控件,还有一个链接控件,计划实现加减乘除,平方,开方,log, ln的功能&&&&&7.如下图,单击其中一个button按钮,在右下方的属性里找到text并改名,其他的属性暂时不要动,以后可以慢慢改。8.修改后的Form1编辑框如下图左边所示。&下面就是代码的编写了:9.双击Form1 窗体后,进入Form1.cs*界面(说白了是刚才窗体的代码编辑框,也是Form1窗体功能实现的界面)10.下图是初始程序,我们要做的是往里面加代码。&&完整代码:using Susing System.Collections.GponentMusing System.Dusing System.Dusing System.Lusing System.Tusing System.Windows.F&namespace jisuangji{ &&& public partial& class Form1 : Form &&& {&&& &&&&&&&&&&&&&double a = 0; &&&& &&&&&&& double b = 0; &&&&&&&& & bool c = &&&&&&& &&&& &&&&&&&& public Form1() &&&&&&& { &&&&&& &&&&& InitializeComponent(); &&&&&&&&&&& &&}&&&&&&& & private void Form1_Load(object sender, EventArgs e) &&&&&&&&&& {&&&&&&& }&&&&&&&&&&&&& private void button9_Click(object sender, EventArgs e)&&&&&// button9_Click是对应我的1键,如果单纯复制代码,但是跟我的窗体布局不同,一样会报错 &&& { &&&&&&&&& // 算法没问题,只要单击相应的键,进入填入相应的算法即可 && if ( c ==true ) &&&&&&& &&&& { &&&&&&&&&& &&&& textBox1 .Text =""; &&&&&&&&&&& &&&& c= &&&&&&&&&&&& &&& &&&&&&&& } &&&&&&&&&&&&&&&&&&& textBox1.Text+="1"; &&&& && }&&&&&&&& private void button10_Click(object sender, EventArgs e) &&&// button10_Click是对应我的2键&&&&& { &&&&&&&&&& & if(c==true ) &&&&&&&&&&& { &&&&&&&&&&&& &&& textBox1.Text=""; &&&&&&&&& &&&&&& c= &&&&&&&&&&&&&&&&&&&&&&&& & } &&&&&&&&&& && textBox1.Text+="2"; &&&&& &&}&&&&&&&& private void button11_Click(object sender, EventArgs e)&&&& //对应我的3键 &&&& { &&&&&& &&&&& if (c==true ) &&&&&& &&&&& { &&&&&&&&&&&& &&& textBox1 .Text =""; &&&&&&&&&& &&&&& c= &&&&&&&&&&&&& && &&&&&&&&& } &&&&&&&& &&&&& textBox1 .Text +="3"; &&&&&&& & &&&&&& }&&&&&&&& private void button5_Click(object sender, EventArgs e) &&&//对应我的4键 &&&& { &&&&&& &&&&& if(c==true ) &&&&&&&& &&& { &&&&&&&&&& &&&&& textBox1.Text=""; &&&&&&&& &&&&&&& c= &&&&&&&&&&&&&&&&&&&&&&& & } &&&&&&&&&& &&& textBox1.Text+="4"; &&&& &&& }&&&&&&&& private void button6_Click(object sender, EventArgs e) &&&&&&//对应我的5键 & { &&&&&&& &&&& if(c==true ) &&&&& &&&&& { &&&&&&&&&&&&& && textBox1.Text=""; &&&&&&&&& &&&&&& c= &&&&&&&&&&&&&&&&&&&&& } &&&&&&&&&&&&&&& & textBox1.Text+="5"; &&&&& && }&&&&&&& & private void button7_Click(object sender, EventArgs e) &&&//对应我的6键 &&&& { &&&&&& &&&&& if(c==true ) &&&&&&&&& && { &&&&&&&&&&&&&& & textBox1.Text=""; && &&&&&&&&&&&&& c= &&&&&&&&&&&&&&&&&&&&&& &&& } &&&&&&&&& && textBox1.Text+="6"; &&&&&& & }&&&&&&&& private void button1_Click(object sender, EventArgs e) &//对应我的7键 &&&&&& { &&&&&& &&&&& if(c==true ) &&&&&&& &&&& { &&&&&&&&&&& &&&& textBox1.Text=""; &&&&&&& &&&&&&c=&&&&&&&&&& & } &&&&&&&&&&& &&&&&& &&&&&&&&& textBox1.Text+="7"; &&&&&&& }&&&&&&&& private void button2_Click(object sender, EventArgs e) &&//对应我的8键 &&&&& { &&&&&&&&&&& if(c==true ) &&&&&&& &&&& { &&&&&&&&&&&&&&& textBox1.Text=""; &&&&&&&&& &&&&&& c= &&&&&&&&&&&&&&&&&&&& & } &&&&&&& &&&&&&&&& textBox1.Text+="8"; &&& &&&& }&&&&&&&& private void button3_Click(object sender, EventArgs e) &&&//对应我的9键 &&&& { &&&&& &&&&&& if(c==true ) &&&&& &&&&&& { &&&&&&&&&&&&&& & textBox1.Text=""; &&&&&&&&& &&&&&& c= &&&&&&&&&& &&&& } &&&&&&&&& &&& textBox1.Text+="9"; &&& &&&& }&&&&&&& & private void button13_Click(object sender, EventArgs e) &&//对应我0的键,增加了除数不能为0的判断 &&&&& { &&&& &&&&& if(c==true )&&&&&&&& &&& { &&&&&&&&&&&&&& & textBox1.Text=""; &&&& &&&&&&&&&&& c=&&&&&&&&&&& } &&&&&&&& & textBox1.Text += "0";&&&&&&&& if (d == "/") &&&&&&& &&&&&&&& { &&&&&&&&&& &&&&&&&&& textBox1.Clear(); &&&&&&&&&&& &&&&&&&&&&&& MessageBox.Show("除数不能为零", "错误提示", MessageBoxButtons.OK,&& MessageBoxIcon.Warning); &&&&&&&&&&&&&&& } &&& &&&&& && }&&&&&&& & private void button4_Click(object sender, EventArgs e) &&//对应我的+键 &&&&& { &&&&&&&&&& &&&&&&&&&& & c = &&&&&&&& &&& b = double.Parse(textBox1.Text); &&&&&& &&&&& d = "+"; &&&&&& & }&&&&&&&& private void button8_Click(object sender, EventArgs e) &&//对应我的-键 &&&&& { &&&& &&&&&&&& c = &&&&&& &&&&& b = double.Parse(textBox1.Text); &&& &&&&&&&& d = "-"; &&&&&& & }&&&&&&& private void button12_Click(object sender, EventArgs e) &&//对应我的*键 &&&&& { &&&&&&& &&&&& &&&&&& c = &&&&&& &&&&& b = double.Parse(textBox1.Text); & &&&&&&&&&& &d = "*"; &&& &&&& }&&&&&&&& private void button16_Click(object sender, EventArgs e) &&&//对应我的/键&&&& { &&&&&&& &&&&& c = &&&&& &&&&&& b = double.Parse(textBox1.Text); &&&& &&&&&&& d = "/"; &&&&&& & }&&&&&& && private void button17_Click(object sender, EventArgs e) &&&//对应我的平方键 &&&& { &&&&&&& &&&& c = &&&&&&& &&&& b = double.Parse(textBox1.Text); &&&& &&&&&&& d = "x2"; & &&&&&& }&&&&& &&& private void button18_Click(object sender, EventArgs e) &&&//对应我的开方键 &&&& { &&&&&&&&& && c = &&&&& &&&&&& b = double.Parse(textBox1.Text); &&&&& &&&&&& d = "sqrt"; &&&&&&& } &&&&&&& private void button19_Click(object sender, EventArgs e) &&//对应我的log键 &&&&& { &&&& &&&&&&& c = && &&&&&&&&& b = double.Parse(textBox1.Text); &&&&& &&&&&& d = "log"; &&&&& && }&&& &private void button20_Click(object sender, EventArgs e) &&&&&//对应我的ln键 && { &&&&&&&&& && c = && &&&&&&&&& b = double.Parse(textBox1.Text); &&& &&&&&&&& d = "ln"; &&& &&&& }&&&&&&&&&&&&& private void button15_Click(object sender, EventArgs e) &//对应我的=键 &&&&&& { &&&&&&&&&& & switch (d) &&&&&&&& &&&&&&&& {&&&&&&&&&&&&&&& &&&&case "+": a = b + double.Parse(textBox1.Text); &&&& &&&&&&&&&&&&&&& case "-": a = b - double.Parse(textBox1.Text); &&& & &&&&&&&&&&&&&&&& case "*": a = b * double.Parse(textBox1.Text); &&&&&&& &&&&&&&&&& &&&case "/": a = b / double.Parse(textBox1.Text); &&&&&&&&&& &&&&&&&&& &case "x2": a = b * double.Parse(textBox1.Text); &&&&& &&&&&&&&&&&&&&& &case "sqrt": a = Math.Sqrt(b ); &&&&&&&&&&&&&& &&&& & &case "log": a = Math.Log(double.Parse(textBox1.Text),b ); &&&&& &&&&&&&&&&&&&&& &case "ln": a = Math.Log(b, Math.E);&&&&&&&&&&&&&& &&& } &&&&&&&&&&&&&&&&&&& textBox1.Text = a + ""; &&&&&&&&&&&&&& &&&&& c = &&&& &&&&& }&&&&&&&& private void button14_Click(object sender, EventArgs e) &&&//对应我的c键,实现了清零的功能 &&&& { &&&&&&& &&&& textBox1.Text = ""; & &&&&&& }&&&&&&&&&&&/*&&&& private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) &&& &&&& { &&&&&&&&& && System.Diagnostics.Process.Start("/u/linshuangxi/"); &&&&&& & }&&&&&&&*/&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& && //我注释掉是因为这是一个连接到我的博客的地址,首先需要在窗体拖进来一个LinkLabel控件。&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& //& 然后把注释去掉就可用了 } &&&}&11.点击运行界面,就会出来窗体,偷个懒,我把基本功能效果图和添加属性后的图都放在一起了,如下图:后言:&& 1.尽量不要复制代码,自己动手,丰衣足食&& 2.第一次设计的话,防止出错,保持窗体布局跟我的一样,这样复制代码就不会有问题&& 3. 刚刚讲到按钮的属性设计,先把基本功能实现,然后可以在属性里设计文字大小,颜色,背景等属性设计后的效果图:&&&&&&&&急求大神用VisualStudio2008帮忙设计一个ASP.NET程序,要求使用模板页、多种控件、数据库,具有网站导航。_百度知道
急求大神用VisualStudio2008帮忙设计一个ASP.NET程序,要求使用模板页、多种控件、数据库,具有网站导航。
不需要全部都使用),期末作业。邮箱jfz。急求啊,页面数至少3页、验证控件等、输入控件使用多种控件(输出控件
我有更好的答案
这...我到现在还没有图形化界面操作,但系统时间的功能调用的时间(time_h *)你找到另一位大神..
baidu hi 联系, 有条件可以帮你, 联系方式见个人简介
其他类似问题
为您推荐:
您可能关注的推广
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁君,已阅读到文档的结尾了呢~~
扫扫二维码,随身浏览文档
手机或平板扫扫即可继续访问
02 第2章 Visual Studio 2008编程.doc
举报该文档为侵权文档。
举报该文档含有违规或不良信息。
反馈该文档无法正常浏览。
举报该文档为重复文档。
推荐理由:
将文档分享至:
分享完整地址
文档地址:
粘贴到BBS或博客
flash地址:
支持嵌入FLASH地址的网站使用
html代码:
&embed src='/DocinViewer-4.swf' width='100%' height='600' type=application/x-shockwave-flash ALLOWFULLSCREEN='true' ALLOWSCRIPTACCESS='always'&&/embed&
450px*300px480px*400px650px*490px
支持嵌入HTML代码的网站使用
您的内容已经提交成功
您所提交的内容需要审核后才能发布,请您等待!
3秒自动关闭窗口