multiply resources(C#登录界面)

本文目录
C#登录界面
Hi,你今年多大了?喜欢编程吗?
我有一个用C#编写的计算器(Windows窗体)的代码
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace 计算器
{
/// 《summary》
/// Form1 的摘要说明。
/// 《/summary》
public class Form1 : System.Windows.Forms.Form
{
// 存储前一个操作数
protected long iNum1;
//存储运算符
protected char cOperator;
//是否开始输入一个新的数字
protected bool bNumBegins;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.Button button6;
private System.Windows.Forms.Button button7;
private System.Windows.Forms.Button button9;
private System.Windows.Forms.Button button10;
private System.Windows.Forms.Button button11;
private System.Windows.Forms.Button button0;
private System.Windows.Forms.Button buttonEquals;
private System.Windows.Forms.Button buttonAdd;
private System.Windows.Forms.Button buttonSubstract;
private System.Windows.Forms.Button buttonMultiply;
private System.Windows.Forms.TextBox txtOutput;
private System.Windows.Forms.Button buttonDivide;
public System.Windows.Forms.MainMenu help;
private System.Windows.Forms.MenuItem bangzhu;
private System.Windows.Forms.MenuItem howtouse;
private System.Windows.Forms.MenuItem about;
private System.Windows.Forms.MenuItem look;
/// 《summary》
/// 必需的设计器变量。
/// 《/summary》
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
EventHandler eh = new EventHandler(this.Numbers_Click);
button0.Click += eh;
button1.Click += eh;
button2.Click += eh;
button3.Click += eh;
button5.Click += eh;
button6.Click += eh;
button7.Click += eh;
button9.Click += eh;
button10.Click += eh;
button11.Click += eh;
eh = new EventHandler(this.Operators_Click);
buttonAdd.Click += eh;
buttonSubstract.Click += eh;
buttonMultiply.Click += eh;
buttonDivide.Click += eh;
buttonEquals.Click += eh;
InitMembers();
}
/// 《summary》
/// 清理所有正在使用的资源。
/// 《/summary》
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
private void InitMembers()
{
iNum1 = 0;
cOperator = ’=’;
bNumBegins = true;
}
// 当用户按下 0 - 9 这10个键时的情况
private void Numbers_Click(object sender, System.EventArgs e)
{
if(txtOutput.Text == "Error")
{
txtOutput.Text = "0";
}
try
{
// 取得输入
long iCurrent = long.Parse(txtOutput.Text);
long i = long.Parse(((Button)sender).Text);
if(bNumBegins)
{
iCurrent = i;
bNumBegins = false;
}
else
{
// 要求检查运算溢出的情况
checked{iCurrent = (iCurrent * 10) + i;}
}
txtOutput.Text = iCurrent.ToString();
}
catch
{
// 捕捉异常不处理,这样如果用户输入的数字超过界限,
// 程序中显示的数字会保持不变
}
}
// 当用户按下5个运算符时的情况
private void Operators_Click(object sender, System.EventArgs e)
{
char op = ((Button)sender).Text;
long iCurrent;
try
{
iCurrent = long.Parse(txtOutput.Text);
}
catch
{
txtOutput.Text = "Error";
InitMembers();
return;
}
// 计算结果
long iResult;
try
{
switch(cOperator)
{
case ’+’:
checked{iResult = iNum1 + iCurrent;}
break;
case ’-’:
checked{iResult = iNum1 - iCurrent;}
break;
case ’*’:
checked{iResult = iNum1 * iCurrent;}
break;
case ’/’:
checked{iResult = iNum1 / iCurrent;}
break;
default:
iResult = iCurrent;
break;
}
}
catch
{
// 如果在计算中发生溢出,则显示"Error"
// 并重置整个状态
txtOutput.Text = "Error";
InitMembers();
return;
}
// 输出结果,并把当前的结果保存起来
txtOutput.Text = iResult.ToString();
iNum1 = iResult;
//准备接受下一个操作数
bNumBegins = true;
// 保存符号
cOperator = op;
}
#region Windows 窗体设计器生成的代码
/// 《summary》
/// 设计器支持所需的方法 - 不要使用代码器修改
/// 此方法的内容。
/// 《/summary》
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
this.txtOutput = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.buttonAdd = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.button6 = new System.Windows.Forms.Button();
this.button7 = new System.Windows.Forms.Button();
this.buttonSubstract = new System.Windows.Forms.Button();
this.button9 = new System.Windows.Forms.Button();
this.button10 = new System.Windows.Forms.Button();
this.button11 = new System.Windows.Forms.Button();
this.buttonMultiply = new System.Windows.Forms.Button();
this.buttonEquals = new System.Windows.Forms.Button();
this.button0 = new System.Windows.Forms.Button();
this.buttonDivide = new System.Windows.Forms.Button();
this.help = new System.Windows.Forms.MainMenu();
this.bangzhu = new System.Windows.Forms.MenuItem();
this.howtouse = new System.Windows.Forms.MenuItem();
this.about = new System.Windows.Forms.MenuItem();
this.look = new System.Windows.Forms.MenuItem();
this.SuspendLayout();
//
// txtOutput
//
this.txtOutput.Location = new System.Drawing.Point(60, 8);
this.txtOutput.MaxLength = 19;
this.txtOutput.Name = "txtOutput";
this.txtOutput.ReadOnly = true;
this.txtOutput.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.txtOutput.Size = new System.Drawing.Size(256, 21);
this.txtOutput.TabIndex = 0;
this.txtOutput.Text = "0";
//
// button1
//
this.button1.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.button1.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.button1.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(192)), ((System.Byte)(192)));
this.button1.Location = new System.Drawing.Point(56, 40);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(48, 48);
this.button1.TabIndex = 1;
this.button1.Text = "1";
//
// button2
//
this.button2.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.button2.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.button2.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(255)), ((System.Byte)(192)));
this.button2.Location = new System.Drawing.Point(128, 40);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(48, 48);
this.button2.TabIndex = 2;
this.button2.Text = "2";
//
// button3
//
this.button3.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.button3.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.button3.ForeColor = System.Drawing.Color.Lime;
this.button3.Location = new System.Drawing.Point(200, 40);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(48, 48);
this.button3.TabIndex = 3;
this.button3.Text = "3";
//
// buttonAdd
//
this.buttonAdd.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.buttonAdd.Location = new System.Drawing.Point(272, 40);
this.buttonAdd.Name = "buttonAdd";
this.buttonAdd.Size = new System.Drawing.Size(48, 48);
this.buttonAdd.TabIndex = 4;
this.buttonAdd.Text = "+";
//
// button5
//
this.button5.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.button5.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(128)), ((System.Byte)(0)));
this.button5.Location = new System.Drawing.Point(56, 96);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(48, 48);
this.button5.TabIndex = 5;
this.button5.Text = "4";
//
// button6
//
this.button6.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.button6.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(0)), ((System.Byte)(192)));
this.button6.Location = new System.Drawing.Point(128, 96);
this.button6.Name = "button6";
this.button6.Size = new System.Drawing.Size(48, 48);
this.button6.TabIndex = 6;
this.button6.Text = "5";
//
// button7
//
this.button7.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.button7.ForeColor = System.Drawing.Color.Green;
this.button7.Location = new System.Drawing.Point(200, 96);
this.button7.Name = "button7";
this.button7.Size = new System.Drawing.Size(48, 48);
this.button7.TabIndex = 7;
this.button7.Text = "6";
//
// buttonSubstract
//
this.buttonSubstract.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.buttonSubstract.Location = new System.Drawing.Point(272, 96);
this.buttonSubstract.Name = "buttonSubstract";
this.buttonSubstract.Size = new System.Drawing.Size(48, 48);
this.buttonSubstract.TabIndex = 8;
this.buttonSubstract.Text = "-";
//
// button9
//
this.button9.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.button9.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(64)), ((System.Byte)(0)));
this.button9.Location = new System.Drawing.Point(56, 152);
this.button9.Name = "button9";
this.button9.Size = new System.Drawing.Size(48, 48);
this.button9.TabIndex = 9;
this.button9.Text = "7";
//
// button10
//
this.button10.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.button10.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.button10.ForeColor = System.Drawing.Color.Purple;
this.button10.Location = new System.Drawing.Point(128, 152);
this.button10.Name = "button10";
this.button10.Size = new System.Drawing.Size(48, 48);
this.button10.TabIndex = 10;
this.button10.Text = "8";
//
// button11
//
this.button11.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.button11.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.button11.ForeColor = System.Drawing.Color.Blue;
this.button11.Location = new System.Drawing.Point(200, 152);
this.button11.Name = "button11";
this.button11.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.button11.Size = new System.Drawing.Size(48, 48);
this.button11.TabIndex = 11;
this.button11.Text = "9";
//
// buttonMultiply
//
this.buttonMultiply.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.buttonMultiply.Location = new System.Drawing.Point(272, 152);
this.buttonMultiply.Name = "buttonMultiply";
this.buttonMultiply.Size = new System.Drawing.Size(48, 48);
this.buttonMultiply.TabIndex = 12;
this.buttonMultiply.Text = "*";
//
// buttonEquals
//
this.buttonEquals.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.buttonEquals.Location = new System.Drawing.Point(136, 224);
this.buttonEquals.Name = "buttonEquals";
this.buttonEquals.Size = new System.Drawing.Size(104, 32);
this.buttonEquals.TabIndex = 13;
this.buttonEquals.Text = "=";
//
// button0
//
this.button0.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.button0.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.button0.ForeColor = System.Drawing.SystemColors.MenuText;
this.button0.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.button0.Location = new System.Drawing.Point(56, 208);
this.button0.Name = "button0";
this.button0.Size = new System.Drawing.Size(48, 48);
this.button0.TabIndex = 14;
this.button0.Text = "0";
//
// buttonDivide
//
this.buttonDivide.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.buttonDivide.Location = new System.Drawing.Point(272, 208);
this.buttonDivide.Name = "buttonDivide";
this.buttonDivide.Size = new System.Drawing.Size(48, 48);
this.buttonDivide.TabIndex = 15;
this.buttonDivide.Text = "/";
//
// help
//
this.help.MenuItems.AddRange(new System.Windows.Forms.MenuItem {
this.bangzhu});
//
// bangzhu
//
this.bangzhu.Index = 0;
this.bangzhu.MenuItems.AddRange(new System.Windows.Forms.MenuItem {
this.howtouse,
this.about,
this.look});
this.bangzhu.Text = "帮助";
//
// howtouse
//
this.howtouse.Index = 0;
this.howtouse.Text = "如何使用";
//
// about
//
this.about.Index = 1;
this.about.Text = "关于作者";
//
// look
//
this.look.Index = 2;
this.look.Text = "查看源代码";
//
// Form1
//
this.AllowDrop = true;
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.AutoScroll = true;
this.AutoScrollMargin = new System.Drawing.Size(1, 1);
this.AutoScrollMinSize = new System.Drawing.Size(2, 2);
this.BackColor = System.Drawing.Color.Gainsboro;
this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
this.ClientSize = new System.Drawing.Size(376, 310);
this.Controls.Add(this.buttonDivide);
this.Controls.Add(this.button0);
this.Controls.Add(this.buttonEquals);
this.Controls.Add(this.buttonMultiply);
this.Controls.Add(this.button11);
this.Controls.Add(this.button10);
this.Controls.Add(this.button9);
this.Controls.Add(this.buttonSubstract);
this.Controls.Add(this.button7);
this.Controls.Add(this.button6);
this.Controls.Add(this.button5);
this.Controls.Add(this.buttonAdd);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.txtOutput);
this.Cursor = System.Windows.Forms.Cursors.Arrow;
this.ForeColor = System.Drawing.Color.Black;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
this.HelpButton = true;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.ImeMode = System.Windows.Forms.ImeMode.On;
this.KeyPreview = true;
this.MaximizeBox = false;
this.Menu = this.help;
this.Name = "Form1";
this.Opacity = 0.9;
this.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "计算器HappyZhe1.0";
this.TopMost = true;
this.TransparencyKey = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(255)), ((System.Byte)(192)));
this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
this.Load += new System.EventHandler(this.HappyZhe_Load);
this.ResumeLayout(false);
}
#endregion
/// 《summary》
/// 应用程序的主入口点。
/// 《/summary》
static void Main()
{
Application.Run(new Form1());
}
private void HappyZhe_Load(object sender, System.EventArgs e)
{
}
private void button4_Click(object sender, System.EventArgs e)
{
}
}
}
我也是刚上路的,几乎对编程没什么了解,希望有人可以和我一起学习研究,我可以加你的QQ吗?
有兴趣的话,可以先来我的空间看看
***隐藏网址***
你可以先给我留言,希望能找到知己!
英文阅读理解,求高手帮忙啊!Look at your watch for just one minute.During
我做的答案是1.C 2.D 3.D 4.B 5.A,应给对了,,2,1C 2 D 3 D 4 B 5 A,1,1、C
2、D
3、D
4、B
5、A,0,英文阅读理解,求高手帮忙啊!
look at your watch for just one minute.during that time the population of the world increased by eighty-five people.perhaps you think that isn’t much.in the next hour,more than 5,000 additional,people will be living on this planet.so it goes,hour after hour.in one day,there are about 120,000 additional mouths to feed.multiply this by 365.what will happen in 100 years?
this population explosion may be the greatest challenge of today.within the next forty years,the world population may double.can the new frontiers of science meet the needs of the crowded world of tomorrow?
if the present rate of population increase for the next 600 or 700 years,there will be standing room only.each person will have between 3 to 10 square feet of space in which to live.this includes the mountaintops,deserts,and the ice and snow fields of the polar regions.of course,no one expects such a thing to happen.war,plague,famine,or some other catastraphe can expected to occur long before the population reaches this point.actually,the danger is not in an overcrowded world where people are huddled together so that they cannot move arms and legs,but in an upset balance between population and resources.
1.this passage mainly talks about______.
a.the rate of population increase
b.the total number of population in the world
c.the problems caused by population explosion
d.the relation of science and population
2.according to the auther,in a hundred years’time______.
a.the world’s population will be doubled
b.the world’s population will be four thousand,three hundred and eighty million
c.there will be standing room only on this planet
d.there will be four thousand,three hundred and eighty million more people born to this planet
3."an upset balance between population and resources"means"______".
a.some people have more resource than others
b.people will be worried about their resources
c.a *** all number of people will control most of the resources
d.there will not be enough resources to meet the needs of the large population
4.which of the following statements is not true?
a.eight-five people are born in this planet every minute.
b.there will be about 120,000 people in this planet tomorrow.
c.the world population in forty years will be twice as much as that of today.
d.each person will only have standing room in 600 or 700 years.
5.according to the passage,population control is necessary because______.
a.too much population can cause trouble
b.our *** objects to population explosion
c.three will not be enough food to meet the needs of the large population
d.most of people only want to have one child

更多文章:
cstring变量(evc中怎么把CString变量转换成double变量)
2025年11月14日 03:15
override代表什么意思(这个代码中@Override 是什么意思)
2025年6月7日 10:30
certainly口语用法(really和certainly用法有什么区别)
2026年5月25日 11:00
headerstyles设表头样式(word怎么绘制表头斜线并打字)
2026年8月7日 22:15
福特福克斯active底盘评测(长安福特全新福克斯表现如何四缸的回归是正确的吗)
2026年7月19日 02:45














