亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

C#動(dòng)態(tài)創(chuàng)建button按鈕的方法實(shí)例詳解

 更新時(shí)間:2017年06月06日 10:34:40   投稿:lqh  
這篇文章主要介紹了C#動(dòng)態(tài)創(chuàng)建button按鈕的方法實(shí)例詳解的相關(guān)資料,需要的朋友可以參考下

C#動(dòng)態(tài)創(chuàng)建button按鈕的方法實(shí)例詳解

C#編程中經(jīng)常需要?jiǎng)討B(tài)創(chuàng)建,本文主要介紹C#動(dòng)態(tài)創(chuàng)建button按鈕的方法,涉及C#按鈕屬性動(dòng)態(tài)設(shè)置的相關(guān)技巧,以供借鑒參考。具體實(shí)現(xiàn)方法如下:

例子:

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("點(diǎn)擊了click事件");
 
  }
 
 }
 
}
 
//注意:主要是看事件

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

相關(guān)文章

最新評(píng)論