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

首頁 > 編程 > C# > 正文

C#動態創建button的方法

2020-01-24 01:29:44
字體:
來源:轉載
供稿:網友

本文實例講述了C#動態創建button的方法。分享給大家供大家參考。具體實現方法如下:

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#程序設計有所幫助。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 丹凤县| 怀远县| 山阳县| 泸州市| 濮阳市| 平顶山市| 广平县| 赫章县| 太湖县| 新源县| 城步| 泊头市| 河池市| 岳池县| 西乡县| 郁南县| 丰城市| 洪洞县| 聂拉木县| 泾源县| 华容县| 蒙城县| 遂川县| 长治县| 社旗县| 广平县| 金平| 沙田区| 泰州市| 保康县| 方山县| 香格里拉县| 洪洞县| 湄潭县| 永嘉县| 景泰县| 台前县| 涟水县| 电白县| 吉木乃县| 吴桥县|