值得说的就是添加一个回车事件,

http://blog.csdn.net/nanwang314/article/details/6176604

private void textBox1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
if(e.KeyCode==Keys.Enter)
{
MessageBox.Show("您在textBox1里按下了回车键");
}
}

  这个样子就可以添加一个回车事件…………

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms; namespace CircleAreaW
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void button1_Click(object sender, EventArgs e)
{
double r;
r = double.Parse(txtR.Text);
MyCircle aCircle = new MyCircle(r); double aArea = aCircle.CircleArea();
dblArea.Text = aArea.ToString("f4");
} private void txtR_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
MessageBox.Show("您在textBox1里按下了回车键"); double r;
r = double.Parse(txtR.Text);
MyCircle aCircle = new MyCircle(r); double aArea = aCircle.CircleArea();
dblArea.Text = aArea.ToString("f4");
}
}
}
}

Form1.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks; namespace CircleAreaW
{
class MyCircle
{
double circleR;
public MyCircle(double dblR)
{
circleR = dblR;
}
public double CircleArea()
{
double dblArea = Math.PI * circleR * circleR;
return dblArea;
}
}
}

C#程序设计---->计算圆面积windows程序的更多相关文章

  1. windows程序设计.第一个windos程序

    Windows程序设计(第5版) windows程序需要调用API. 第一个Windows程序 /*HelloMsg.c -- Displays "Hello World!" in ...

  2. Windows程序设计学习笔记(1):一个简单的windows程序

    <Windows程序设计>(第五版)(美Charles Petzold著) #include<windows.h> LRESULT CALLBACK WndProc(HWND, ...

  3. 《汇编语言程序设计》——仿windows计算器

    <汇编语言程序设计> ——计算器程序设计 目录 一.     题目与目标 1.      题目 2.      学习目的 二.     分析与设计 1.      系统分析 2.      ...

  4. Windows编程 Windows程序的生与死(下)

    再谈程序之“死” 记得在第二回中我对程序的“死”只是一句话带过,因为我还没有铺垫好,好了现在我们可以详细的分析一下这个过程了. 这还要从while消息循环说起,还记得GetMessage函数吗?它是一 ...

  5. 第三章—Windows程序

    这一章我都不知道该如何写了,呵呵~~ 毕竟,Win32是一个非常深奥的系统,目前还容不得我这种 小辈在这儿说三道四,不过,我既然是要写给那些入门阶段的朋友们看的,又不是写给那些搞程序设计老鸟看的,所以 ...

  6. 第一个Windows程序

    今天,我们的任务就是和大家一起开发第一个Windows程序,这个程序的功能非常简单,就是弹出一个对话框,但是简单的程序可以帮助大家建立信心. 例1 第一个Windows程序 /* ********** ...

  7. C++学习笔记1(Windows程序运行原理及程序编写流程)

    窗口产生过程,句柄原理,消息队列,回调函数,窗口关闭与应用程序退出的工作关系,使用VC++的若干小技巧,stdcall与Lessonecl调用规范的比较,初学者常犯错误及注意事项.以下是应用程序与操作 ...

  8. windows程序内部运行机制

    Windows程序内部运行机制 2007-10-21 19:52 1010人阅读 评论(0) 收藏 举报 windowsvc++applicationcallbackwinapistructure W ...

  9. 初识Windows程序

    首先,我们创建第一个Windows程序,一共分为4个步骤: 1.打开Visual Studio开发工具 2.选择"文件"→"新建"→"项目" ...

随机推荐

  1. Combination Lock

    时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 Finally, you come to the interview room. You know that a Micr ...

  2. 【iCore3 双核心板_FPGA】实验二十:基于FIFO的ARM+FPGA数据存取实验

    实验指导书及代码包下载: http://pan.baidu.com/s/1cmisnO iCore3 购买链接: https://item.taobao.com/item.htm?id=5242294 ...

  3. ios-改变button四个角的弧度

    -(void)createTitleView{ UIView * backview = [[UIView alloc]init]; backview.frame =CGRectMake(87*kHei ...

  4. 转载~kxcfzyk:Linux C语言多线程库Pthread中条件变量的的正确用法逐步详解

    Linux C语言多线程库Pthread中条件变量的的正确用法逐步详解   多线程c语言linuxsemaphore条件变量 (本文的读者定位是了解Pthread常用多线程API和Pthread互斥锁 ...

  5. Where is the Global.asax.cs file

    I am using VS 2008. I have created a new Asp.net web site project from File->New->Website-> ...

  6. java API 知识:截取特殊标识之前的字符串

    一: double a = 23.36; String b = String.valueOf(a); String d = b.substring(, b.lastIndexOf(".&qu ...

  7. iOS开发网络篇—简单介绍ASI框架的使用

    iOS开发网络篇—简单介绍ASI框架的使用 说明:本文主要介绍网络编程中常用框架ASI的简单使用. 一.ASI简单介绍 ASI:全称是ASIHTTPRequest,外号“HTTP终结者”,功能十分强大 ...

  8. Android 通过 Wifi 调试 Debug (Android Studio)

    参考资料: http://www.cnblogs.com/sunzhenxing19860608/archive/2011/07/14/2106492.html 前提: Android 手机 和 PC ...

  9. Java基础之在窗口中绘图——移动曲线的控制点(CurveApplet 3 moving the control points)

    Applet程序. import javax.swing.*; import java.awt.*; import java.awt.geom.*; import javax.swing.event. ...

  10. PHP5与MySQL数据库操作

    1 建立数据库表:  2 读取数据 2.1 建立01.php 2.2 建立member.php  3 修改数据 3.1 建立level.php(修改数据) 3.2 建立up_level.php  4 ...