欧美大屁股bbbbxxxx,狼人大香伊蕉国产www亚洲,男ji大巴进入女人的视频小说,男人把ji大巴放进女人免费视频,免费情侣作爱视频

歡迎來(lái)到入門(mén)教程網(wǎng)!

C#教程

當(dāng)前位置:主頁(yè) > 軟件編程 > C#教程 >

C#用記事本編寫(xiě)簡(jiǎn)單WinForm窗體程序

來(lái)源:本站原創(chuàng)|時(shí)間:2020-01-10|欄目:C#教程|點(diǎn)擊: 次

平時(shí)我們編寫(xiě)WinForm程序經(jīng)常使用VS進(jìn)行拖控件的方式,這樣做雖然簡(jiǎn)單,但是無(wú)法深入了解WinForm程序的本質(zhì)。其實(shí),用記事本也可以編寫(xiě)出VS編寫(xiě)的WinForm程序。還是直接看代碼吧:

1、打開(kāi)記事本,寫(xiě)入以下代碼,另存為hello.cs文件

using System;
using System.Windows.Forms;

namespace Hello
{
 public class Form1:Form
 {
  private System.Windows.Forms.Button btnClose;
  public Form1()
  {
    this.Text = "Form1窗體";
    btnClose = new System.Windows.Forms.Button();
    //將窗體掛起
    this.SuspendLayout();

    //設(shè)置按鈕屬性
    this.btnClose.Location = new System.Drawing.Point(20,20);
    this.btnClose.Size = new System.Drawing.Size(100,25);
    this.btnClose.Name = "btnClose";
    this.btnClose.Text = "按鈕";

    this.btnClose.UseVisualStyleBackColor = true;

    //設(shè)置按鈕控件點(diǎn)擊事件
    this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
    //將構(gòu)造的控件添加到窗體Controls控件集合
    this.Controls.Add(btnClose);
  }
  //按鈕點(diǎn)擊事件
   private void btnClose_Click(object sender,EventArgs e)
   {
   this.Close();
   }
 }
 public class Program
 {
  //程序入口
  public static void Main()
  {
   Application.Run(new Form1());
  }
 }
}

2、在Windows搜索框輸入 cmd,打開(kāi)控制臺(tái),輸入以下代碼切換目錄

cd C:\Windows\Microsoft.NET\Framework\v4.0.30319

3、目錄切換完畢后,輸入以下代碼運(yùn)行

csc.exe /out:e:\hello.exe e:\hello.cs

/out:e:\hello.exe用于指定可執(zhí)行文件存放的目錄和名稱(chēng)
e:\hello.cs用于指定源文件的文件路徑


以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持我們。

上一篇:C#使用SqlConnection連接到SQL Server的代碼示例

欄    目:C#教程

下一篇:C#遍歷文件夾獲取指定后綴名文件

本文標(biāo)題:C#用記事本編寫(xiě)簡(jiǎn)單WinForm窗體程序

本文地址:http://mengdiqiu.com.cn/a1/C_jiaocheng/4815.html

網(wǎng)頁(yè)制作CMS教程網(wǎng)絡(luò)編程軟件編程腳本語(yǔ)言數(shù)據(jù)庫(kù)服務(wù)器

如果侵犯了您的權(quán)利,請(qǐng)與我們聯(lián)系,我們將在24小時(shí)內(nèi)進(jìn)行處理、任何非本站因素導(dǎo)致的法律后果,本站均不負(fù)任何責(zé)任。

聯(lián)系QQ:835971066 | 郵箱:835971066#qq.com(#換成@)

Copyright © 2002-2020 腳本教程網(wǎng) 版權(quán)所有