To develop windows application, we need to using studio and follow some steps:

开发Windows应用程序 ,我们需要使用studio并遵循一些步骤:

Step 1) First of all we launch visual studio.

步骤1)首先,我们启动Visual Studio。

Step 2) Goto fie menu and select new project.

第2步:转到菜单,然后选择新项目

.minHeight{ min-height: 250px; } @media (min-width: 1025px){ .minHeight{ min-height: 90px; } } .minHeight{ min-height: 250px; } @media (min-width: 1025px){ .minHeight{ min-height: 90px; } }

Step 3) Now we select "Visual C#" from left panel and select "Windows Forms Application" and give appropriate name to our application. Here I provided name "MyWinApp".

步骤3)现在,我们从左侧面板中选择“ Visual C#” ,然后选择“ Windows Forms Application”,并为我们的应用程序指定适当的名称。 在这里,我提供了名称“ MyWinApp”

Step 4) Then A default generated form will appear in our application, like this:

步骤4)然后,默认生成的表单将出现在我们的应用程序中,如下所示:

.minHeight{ min-height: 250px; } @media (min-width: 1025px){ .minHeight{ min-height: 90px; } } .minHeight{ min-height: 250px; } @media (min-width: 1025px){ .minHeight{ min-height: 90px; } }

Here we have following things:

这里有以下内容:

  1. ToolBox

    工具箱

    It contains tool to develop the application.

    它包含用于开发应用程序的工具。

  2. Solution Explorer

    解决方案资源管理器

    It contains our project detail; it shows all files related to our project.

    它包含我们的项目详细信息; 它显示了与我们项目相关的所有文件。

  3. Property window

    属性窗口

    Using property window we can change the properties of controls which are used in our application.

    使用属性窗口,我们可以更改应用程序中使用的控件的属性。

Building the solution

建立解决方案

We can build our project or solution using build menu or shortcut key: Ctrl + Shift +B.

我们可以使用构建菜单或快捷键Ctrl + Shift + B构建项目或解决方案。

Execution of Application

执行申请

We can execute our application with or without debugging. Here, we use debug menu or it can also be done by using shortcut key: F5 or CTRL+F5.

我们可以在调试或不调试的情况下执行我们的应用程序。 在这里,我们使用调试菜单 ,也可以使用快捷键F5CTRL + F5来完成

通过单击按钮控件,设计一个应用程序以在MessageBox上显示“ Hello World”消息 (Design an application to display "Hello World" message on MessageBox by clicking on button control)

First of all, we create a windows application. And then drag and drop a button from toolbox to container form.

首先,我们创建一个Windows应用程序。 然后将一个按钮从工具箱拖放到容器窗体。

.minHeight{ min-height: 250px; } @media (min-width: 1025px){ .minHeight{ min-height: 90px; } } .minHeight{ min-height: 250px; } @media (min-width: 1025px){ .minHeight{ min-height: 90px; } }

We can change the name, color and text etc of any control using property window, here we change our form text to "My First Windows Application" and button text to "Click Me".

我们可以使用属性窗口更改任何控件的名称,颜色和文本等,这里我们将表单文本更改为“我的第一个Windows应用程序” ,将按钮文本更改为“点击我”

Now, we wrote code on button's click event, we can generate sample code for click event by "double click" on the button. Then the generated code will we like this:

现在,我们在按钮的click事件上编写了代码,我们可以通过“双击”按钮来为click事件生成示例代码。 然后生成的代码将如下所示:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace MyWinApp
{public partial class Form1 : Form
{public Form1()
{InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{}
}
}

Here button1_Click function will use as a click event, here we can write code what we want to do on click event on the button. Now we wrote code to show MessageBox to display "Hello World".

在这里, button1_Click函数将用作click事件,在这里我们可以编写代码,以对按钮上的click事件进行操作。 现在,我们编写了代码来显示MessageBox来显示“ Hello World”

private void button1_Click(object sender, EventArgs e)
{MessageBox.Show("Hello World");
}

Execute application using CTRL+F5. Here is the output after clicking on the button "Click Me":

使用CTRL + F5执行应用程序。 这是单击“ Click Me”按钮后的输出

翻译自: https://www.includehelp.com/dot-net/develop-a-windows-application-in-c-sharp.aspx

用C#开发Windows应用程序相关推荐

  1. vs 窗体连接mysql_vs2008 c#开发windows窗体程序,怎么连接数据库?

    你的位置: 问答吧 -> .NET -> 问题详情 vs2008 c#开发windows窗体程序,怎么连接数据库? 我的oracle服务器为WebServer数据库为MIS,用户名为MIS ...

  2. .net core 开发 Windows Forms 程序

    我是一名 ASP.NET 程序员,专注于 B/S 项目开发.累计文章阅读量超过一千万,我的博客主页地址:https://www.itsvse.com/blog_xzz.html 引言 .net cor ...

  3. 使用python开发windows应用程序

    本人以前一直用的是C++,MFC,毕业到了公司以后,公司用python做流程,我顺便最近研究了一下用python开发windows应用程序的整个流程,大体如下: 一.开发前期准备 1.boa-cons ...

  4. 使用Python开发windows桌面程序

    使用Python开发windows桌面程序 一.开发前期准备 1. boa-constructor-0.6.1.bin.setup.exe #一个wxWidges的集成开发环境,简单如Delphi,可 ...

  5. html+js开发windows桌面程序的方案(miniblink)

    最近需要开发windows桌面程序,但由于界面复杂多变且项目周期较短,故放弃完全使用qt或mfc来开发,首先考虑了Electron,但发现其打包的程序实在太大超过了100M,偶然间发现某vpn软件使用 ...

  6. javascript不依赖库开发windows应用程序

    其实javascript不仅可以做网页应用,也可以不依赖任何环境开发windows应用程序.windows系统自带mshta.exe,相当于一个javascript虚拟机,我们把.html文件扩展名改 ...

  7. winpython使用教程-使用Python开发windows桌面程序【超简单】

    一.开发前期准备 1. boa-constructor-0.6.1.bin.setup.exe #一个wxWidges的集成开发环境,简单如Delphi,可以直接拖拽控件,并且和其他集成环境不一样, ...

  8. .NET开发Windows Service程序 - Topshelf

    在实际项目开发过程中,会经常写一些类似定时检查,应用监控的应用.这类应用在windows平台通常都会写成window service程序. 在百度上搜索一下'c#开发windows service', ...

  9. Visual Studio开发Windows Mobile程序

    转自:http://developer.51cto.com/art/200908/144102.htm Visual Studio 2005无疑是开发Windows Mobile的最佳工具,其本身就集 ...

最新文章

  1. mysql校对规则_MySQL中的校对规则
  2. hibernate mysql 映射_使用hibernate建立mysql连接以及生成映射类和配置文件*.cfg.xml
  3. 微信小程序之设置不同的顶部导航栏名称
  4. php7和python3性能对比-python2.7和3.7的区别
  5. mac phpstorm调试php,MAC下phpstorm20190302+Xdebug2.7断点调试PHP | 朱斌技术博客
  6. MATLAB-冒号符号
  7. 设计模式C++实现(15)——观察者模式
  8. exls导入数据库 php_PHP Excel导入数据到MySQL数据库
  9. 使用SAP portal service创建Fiori Launchpad
  10. 直接从chrome中复制的body到postman中希望能自动识别去除空格
  11. 现代软件工程系列 学生和老师都不容易
  12. 五位专家跟你讲讲为啥Python更适合做AI/机器学习
  13. HTML5 — 知识总结篇《VIII》【媒体元素】
  14. 190416每日一句
  15. PL/SQL工具如何连接oracle数据库
  16. linux下搭建radius服务器,CentOS下Radius服务器搭建
  17. 转:IV值和WOE值的理解
  18. 注册公司的步骤及费用
  19. 中国移动、天猫都在用的区块链抽奖,了解一下?
  20. Python中的打包与解包

热门文章

  1. oracle 库存管理系统,库存管理系统
  2. mysql数据库突然连不上了_mysql数据库突然连接不上去
  3. mysql不复制数据_windows mysql不停止服务复制数据
  4. java定义一个course类,求指教定义一个学生类 ,大学生小学生,定义一个选课接口...
  5. Mysql Incorrect DATETIME value: ‘01/01/2021 00:00:00‘
  6. 在react中使用svg的各种骚姿势
  7. CSS3扁平化Loading动画特效
  8. 如何将视频设置为网页背景
  9. springcloud微服务多节点高性能、高可用、高并发部署
  10. C# 只允许运行一个程序实例