国产成人毛片视频|星空传媒久草视频|欧美激情草久视频|久久久久女女|久操超碰在线播放|亚洲强奸一区二区|五月天丁香社区在线|色婷婷成人丁香网|午夜欧美6666|纯肉无码91视频

c#窗體應(yīng)用程序 怎么用c語言寫窗體程序?

怎么用c語言寫窗體程序?步驟: 1、注冊窗口類; 2、創(chuàng)建窗體; 3、消息循環(huán); 4、編寫窗口消息處理函數(shù)。 代碼: #include 列舉在窗體上建立控件的步驟?用代碼向窗體添加控件步驟如下(1)實

怎么用c語言寫窗體程序?

步驟:

1、注冊窗口類;

2、創(chuàng)建窗體;

3、消息循環(huán);

4、編寫窗口消息處理函數(shù)。 代碼: #include

列舉在窗體上建立控件的步驟?

用代碼向窗體添加控件步驟如下

(1)實例化一個控件;

(2)設(shè)置控件實例屬性;

(3)將控件實例添加到窗體的Controls集合中


【示例】用代碼向窗體添加一個命令按鈕,單擊這個按鈕關(guān)閉窗口并退出

(1)在Visual Studio中新建一個“Windos 窗體應(yīng)用程序”

(2)窗體代碼Form1.cs如下:

using System

using System.Collections.Generic

using System.Windows.Forms

using System.Drawing


namespace WindowsFormsApplication1

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent()


//實例化一個命令按鈕

Button btn = new Button()


//設(shè)置命令按鈕的屬性

btn.Location = new Point(50, 50)

btn.Size = new Size(80, 25)

btn.Text = "退出"

btn.Click = btn_Click


//添加到窗口的Controls集合中

this.Controls.Add(btn)

}


void btn_Click(object sender, EventArgs e)

{

this.Close()

}

}

}