国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > C# > 正文

C#動態創建button按鈕的方法實例詳解

2019-10-29 21:10:01
字體:
來源:轉載
供稿:網友

C#動態創建button按鈕的方法實例詳解

C#編程中經常需要動態創建,本文主要介紹C#動態創建button按鈕的方法,涉及C#按鈕屬性動態設置的相關技巧,以供借鑒參考。具體實現方法如下:

例子:

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; using System.Reflection; namespace App {  public partial class Form1 : Form  {   public Form1()   {    InitializeComponent();    System.Windows.Forms.Button button = new Button();    button.Text = "按鈕";    button.Size = new Size(100, 30);    button.Location = new Point(0, 0);    button.Click += delegate    {     ButtonClick();    };    this.Controls.Add(button);   }   void ButtonClick()   {    MessageBox.Show("點擊了click事件");   }  } } //注意:主要是看事件

感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!

 


注:相關教程知識閱讀請移步到c#教程頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 大邑县| 天门市| 宁波市| 通渭县| 广州市| 三台县| 涞源县| 田东县| 三河市| 罗城| 镇平县| 仙桃市| 威海市| 建湖县| 庐江县| 莱阳市| 友谊县| 明星| 台北市| 永福县| 阿勒泰市| 田林县| 浪卡子县| 郑州市| 金堂县| 南和县| 宝应县| 吴江市| 田阳县| 庐江县| 肥城市| 辽宁省| 任丘市| 修文县| 青岛市| 墨竹工卡县| 泗水县| 通山县| 武夷山市| 名山县| 朝阳市|