windows forms如何动态js创建数组按钮数组

vs2008中buttonarray怎么创建啊
vs2008中buttonarray怎么创建啊 5
不区分大小写匿名
大概的说一下吧创建“Windows应用程序”类型的工程,添加名为VB.NET ButtonArray类,并使该类继承 System.Collection.CollectionBase 类。System.Collections.CollectionBase类是.NET框架类库中为集合操作提供抽象的基类,通过对它的继承可以为我们的VB.NET ButtonArray类具备集合增加、删除、索引的功能。2、为VB.NET ButtonArray类添加ParentForm属性,即控件组所在窗体,创建初始化函数(构造函数);3、为控件数组类增加AddItem方法,该方法在控件数组类中添加成员;4、为控件数组类增加RemoveItem方法,该方法在控件数组中删除一个成员。
这个com和num怎么建立的啊
Public&Class&ButtonArray &Inherits&System.Collections.CollectionBase &Private&ReadOnly&ParentForm&As&System.Windows.Forms.Form &Public&Sub&New(ByVal&pForm&As&System.Windows.Forms.Form) &ParentForm&=&pForm&End&Sub &&Default&Public&ReadOnly&Property&Item(ByVal&index&As&Integer)&As&System.Windows.Forms.Button &Get &Return&Me.List.Item(index)&@#&ButtonArray的List'属性从CollectionBase&继承 &End&Get &End&Property &Public&Sub&AddItem() &Dim&btnItem&As&New&System.Windows.Forms.Button &Me.List.Add(btnItem) &ParentForm.Controls.Add(btnItem)'向窗体中增加控件 &btnItem.Tag&=&Me.Count@#Count属性从CollectionBase&继承 &btnItem.Top&=&Me.Count&*&30 &btnItem.Left&=&200&btnItem.Text&=&"Button"&&&Me.Count.ToString &AddHandler&btnItem.Click,&AddressOf&btnItem_Click&'绑定事件处理程序 &End&Sub &&Public&Sub&AddItem(ByVal&btnItem&As&System.Windows.Forms.Button) &Me.List.Add(btnItem) &AddHandler&btnItem.Click,&AddressOf&btnItem_Click&'绑定事件处理程序 &End&Sub &&Public&Sub&RemoveItem() &If&Me.Count&&&0&Then &ParentForm.Controls.Remove(Me(Me.Count&-&1)) &Me.List.RemoveAt(Me.Count&-&1) &End&If &End&Sub &&Public&Sub&btnItem_Click(ByVal&sender&As&Object,&ByVal&e&As&System.EventArgs) &&MsgBox("点击:"&&&sender.GetType().ToString&&&CType(CType(sender,&Button).Tag,&String)) &End&Sub &End&Class&
这个是怎么来的啊
我现在也没软件 没法打开
相关知识等待您来回答
编程领域专家在 Visual Basic .NET 和 Visual C# .NET 中创建控件数组_.NET教程_编程技术
您的位置: &
& 在 Visual Basic .NET 和 Visual C# .NET 中创建控件数组
visual|创建|控件|数组
在 Visual Basic .NET 和 Visual C# .NET 中创建控件数组 Matthew A. StoeckerVisual Studio TeamMicrosoft Corporation 2002 年 1 月 摘要:本文介绍如何使用 Visual Basic& .NET 和 Visual C#™ .NET 创建和管理控件数组。 目录简介 前提 创建项目 实现集合 公开控件数组 创建公共事件处理程序 测试项目 总结 简介数组为使用共享公共功能的控件组提供了一种方便的方式。例如,控件组可以用来显示相关数据,或者在单击时提供相关的操作。Visual Basic .NET 和 C# 本身并不支持创建控件数组,但您可以通过编程来复制控件数组的全部功能。本文将指导您创建一个复制控件数组功能的简单组件。控件数组的某些用处如下所示: 通过索引访问具有相同名称的控件集合,您可以按编号检索和设置属性,并遍历数组中的所有控件。这一操作的典型语法如下:' Visual Basic 伪代码MyControl(myIndex).MyProperty = myValueMyControl(myIndex + 1).MyMethod// C# 伪代码myControl[myIndex].myProperty = myVmyControl[myIndex + 1].myMethod使用单个事件处理程序处理多个控件的事件,检索并使用这些事件中的索引,如下例所示:' Visual Basic 伪代码Private Sub MyControl_Click(sender as Object, e as EventArgs)&&&Messagebox.Show(&您已单击 MyControl 编号& & _&&&&&&MyControl.Index)End Sub// C# 伪代码private void myControl_Click(System.Object sender, System.EventArgs e)&&&{&&&&&&Messagebox.Show(&您已单击 MyControl 编号& +&&&&&&&&&MyControl.Index);&&&}在运行时动态添加或删除控件,如下所示:' Visual Basic 伪代码Dim i as IntegerFor i = 1 to 5&&&' 插入代码以创建控件并为属性分配值。Next i// C# 伪代码for (int i = 1; i & 6; i++){&&&// 插入代码以创建控件并为属性分配值。 }Visual Basic .NET 和 C# 允许您复制部分此类功能,例如,使用代理将多个控件中的事件绑定到单个事件处理程序。但是,如果将该功能并入单个动态的、易于管理的组件,可能会更方便。本文中,我们将创建使用以下内容的组件: 索引和排序控件的集合。按钮集合将用于演示。 处理来自派生按钮的单击事件的事件处理程序。 允许通过索引引用控件及其成员的代码。 在窗体中动态添加和删除控件的代码。 前提熟悉组件及其工作原理。 对多态有所了解。有关详细信息,请参阅 Polymorphism in Components(英文)。 了解 Visual Basic .NET 或 C# .NET 语法。 创建项目本节中,我们将创建和命名项目,并在项目中添加一个类。该类将封装实现控件数组的代码。创建 ButtonArrayProject 和 ButtonArray 组件 在 File(文件)菜单上,指向 New(新建),然后选择 Project(项目)以打开 New Project(新建项目)对话框。 从 Visual Basic 或 Visual C# 项目列表中选择 Windows Application(Windows 应用程序)项目模板,并在 Name(名称)框中键入 ButtonArrayProject。 从 File(文件)菜单中,选择 Save All(全部保存)以保存项目。 实现集合ButtonArray 类将通过实现集合来完成支持和组织控件数组的任务。集合是一个对象,它包含经过索引的对象变量的列表,以及在集合中添加、删除或者操作对象的方法。本节中,我们将创建继承自 System.Collections.CollectionBase(.NET 框架中的类,提供集合所需的很多功能)的类,并实现提供所需功能的方法。创建继承的类 从 Project(项目)菜单中,选择 Add Class(添加类)。 相应地将类命名为 ButtonArray.vb 或 ButtonArray.cs。 将打开包含该类的 Code Editor(代码编辑器)。 在类声明中,指定此类是从 .NET 框架的 System.Collections.CollectionBase 类继承而来的。' Visual BasicPublic Class ButtonArray&&&Inherits System.Collections.CollectionBaseEnd Class// C#public class ButtonArray : System.Collections.CollectionBase{&&&// 省略了由设计器添加的代码。}System.Collections.CollectionBase 类提供集合所需的许多功能。其中包括 List 对象(跟踪集合所包含的对象)、Count 属性(维护当前集合中的对象总数)和 RemoveAt 方法(按特定索引删除对象)。在实现控件数组集合时,要用到这些功能。由于所有控件数组组件都要与一个窗体相关联,因此需要添加一个字段以保留对该窗体的引用。通过创建专用的只读字段来保留该引用,可以确保每个控件数组组件只与一个窗体相关联。在组件中添加专用的只读字段 直接在类声明中添加以下行:' Visual BasicPrivate ReadOnly HostForm as System.Windows.Forms.Form// C#private readonly System.Windows.Forms.Form HostF必须在集合中实现的第一个方法是 AddNewButton。此方法将创建新的按钮控件,并将其添加到所需的窗体中。还需要使用此方法设置新按钮的初始属性。实现 AddNewButton 方法 在包含 ButtonArray 类的 Code Editor(代码编辑器)中,键入以下代码:Public Sub AddNewButton()&&&' 创建 Button 类的新实例。&&&Dim aButton As New System.Windows.Forms.Button()&&&' 将按钮添加到集合的内部列表。&&&Me.List.Add(aButton)&&&' 将按钮添加到由 HostForm 字段&&&&' 引用的窗体的控件集合中。&&&HostForm.Controls.Add(aButton)&&&' 设置按钮对象的初始属性。&&&aButton.Top = Count * 25&&&aButton.Left = 100&&&aButton.Tag = Me.Count&&&aButton.Text = &按钮 & & Me.Count.ToStringEnd Sub// C# public void AddNewButton(){&&&// 创建 Button 类的新实例。&&&System.Windows.Forms.Button aButton = new&&&&&&&System.Windows.Forms.Button();&&&// 将按钮添加到集合的内部列表。&&&this.List.Add(aButton);&&&// 将按钮添加到由 HostForm 字段&&&&// 引用的窗体的控件集合中。&&&HostForm.Controls.Add(aButton);&&&// 设置按钮对象的初始属性。&&&aButton.Top = Count * 25;&&&aButton.Left = 100;&&&aButton.Tag = this.C&&&aButton.Text = &按钮 & + this.Count.ToString();}此方法将: 创建新按钮。 将新按钮添加到内部列表和由 HostForm 引用的窗体的控件集合中。 设置初始属性,包括将 Tag 属性设置为按钮的索引。您可以在本节中添加代码以设置控件的其他属性。 还必须创建一个构造函数(对组件进行实例化时运行的方法),用于设置 HostForm 字段的值,并且只要创建控件数组类的新实例,便可自动在窗体中添加新按钮。您可以通过以下方式完成此任务。创建构造函数 创建类的构造函数。' Visual BasicPublic Sub New(ByVal host as System.Windows.Forms.Form)&&&HostForm = host&&&Me.AddNewButton()End Sub// C# // 使用此构造函数替换默认的构造函数。public ButtonArray(System.Windows.Forms.Form host){&&&HostForm =&&&this.AddNewButton();}构造函数需要一个参数,即放置按钮数组的窗体。它指定提供给 HostForm 字段的值,然后调用类的 AddNewButton 方法在窗体中添加新按钮。 公开控件数组您已经创建了一种方法在数组中创建和跟踪控件,现在需要向其他开发人员公开这些控件。可以使用一个属性来执行此操作。您将创建一个默认属性 (Visual Basic) 或索引程序 (C#),根据索引返回一个对特定按钮的引用。这也使您能够通过编程方式使用控件数组的典型 MyButtonArray(myIndex) 语法。创建默认属性 在组件中添加以下代码。' Visual BasicDefault Public ReadOnly Property Item(ByVal Index As Integer) As _&&&System.Windows.Forms.Button&&&Get&&&&&&Return CType(Me.List.Item(Index), System.Windows.Forms.Button)&&&End GetEnd Property// C#public System.Windows.Forms.Button this [int Index]{get&&&{&&&&&&return (System.Windows.Forms.Button) this.List[Index];&&&}}实现 Remove 方法您已经创建了公开数组中的按钮所需的属性,现在可以实现从数组中删除按钮的机制。要从数组中删除按钮,必须从集合的内部 List 对象和窗体的 Controls 集合中将其删除。实现 Remove 方法 在组件中添加以下方法。' Visual BasicPublic Sub Remove()&&&' 检查以确保存在要删除的按钮。&&&If Me.Count & 0 Then&&&&&&' 从宿主窗体控件集合中删除添加到数组&&&&&&' 的最后一个按钮。请注意在访问数组时&&&&&&' 默认属性的使用。&&&&&&HostForm.Controls.Remove(Me(Me.Count -1))&&&&&&Me.List.RemoveAt(Me.Count -1)&&&End IfEnd Sub// C#public void Remove()}&&&// 检查以确保存在要删除的按钮。&&&if (this.Count & 0)&&&{&&&&&&// 从宿主窗体控件集合中删除添加到数组&&&&&&// 的最后一个按钮。请注意在访问数组时&&&&&&// 索引的使用。&&&&&&HostForm.Controls.Remove(this[this.Count -1]);&&&&&&this.List.RemoveAt(this.Count -1);&&&}}创建公共事件处理程序最后一步是创建事件处理程序以处理数组的公共事件。本例中,我们将创建一种方法来处理按钮的单击事件,然后添加代码以将事件与事件处理程序相关联。创建公共事件处理程序 在组件中添加以下方法。' Visual BasicPublic Sub ClickHandler(ByVal sender As Object, ByVal e As _&&&System.EventArgs)&&&MessageBox.Show(&您已单击按钮 & & CType(CType(sender, _&&&&&&Button).Tag, String))End Sub// C#public void ClickHandler(Object sender, System.EventArgs e){&&&System.Windows.Forms.MessageBox.Show(&您已单击按钮 & +&&&&&&&(string)((System.Windows.Forms.Button) sender).Tag);}此方法显示一个消息框,通过检索存储在按钮的 Tag 属性中的索引来指示单击了什么按钮。注意,此方法的签名与它将要处理的事件的签名相同,这是事件处理程序所要求的。 您还需要将事件与事件处理程序相关联。将事件与事件处理程序相关联 在 AddNewButton 方法中添加以下代码。' Visual BasicAddHandler aButton.Click, AddressOf ClickHandler// C#aButton.Click += new System.EventHandler(ClickHandler);测试项目完成项目之后,您需要创建一个应用程序来测试组件的功能。创建测试应用程序 在 Solution Explorer(解决方案资源管理器)中,右击 Form1 并从快捷菜单中选择 View Designer(视图设计器)。 将打开包含 Form1 的设计器。 从工具箱中,将两个按钮添加到窗体中。 将这些按钮重新定位到窗体的右侧。 按以下所示设置按钮的属性。 按钮名称文本Button1btnAdd添加按钮Button2btnRemove删除按钮在 Solution Explorer(解决方案资源管理器)中,右击 Form1 并从快捷菜单中选择 View Code(查看代码)。 将打开包含 Form1 的 Code Editor(代码编辑器)。 在 Form1 的类声明中,声明控件数组对象。' Visual Basic' 声明新的 ButtonArray 对象。Dim MyControlArray as ButtonArray// C#// 声明新的 ButtonArray 对象。ButtonArray MyControlA在窗体的构造函数中,在方法末尾前面添加以下代码:' Visual BasicMyControlArray = New ButtonArray(Me)// C#MyControlArray = new ButtonArray(this);此语句将创建一个新的 ButtonArray 对象。参数(Me 或 this)将引用创建新 ButtonArray 的窗体,并将成为放置按钮数组的窗体。 在 Solution Explorer(解决方案资源管理器)中,右击 Form1 并从快捷菜单中选择 View Designer(视图设计器)。 在设计器中,双击 btnAdd 以打开包含 btnAdd_Click 事件的 Code Editor(代码编辑器)。 在 btnAdd_Click 方法中,添加代码以调用 MyControlArray 的 AddNewButton 方法:' Visual Basic' 调用 MyControlArray 的 AddNewButton 方法。MyControlArray.AddNewButton()' 更改按钮 0 的 BackColor 属性。MyControlArray(0).BackColor = System.Drawing.Color.Red// C#// 调用 MyControlArray 的 AddNewButton 方法。MyControlArray.AddNewButton();// 更改按钮 0 的 BackColor 属性。MyControlArray[0].BackColor = System.Drawing.Color.R在 Solution Explorer(解决方案资源管理器)中,右击 Form1 并从快捷菜单中选择 View Designer(视图设计器)。 在设计器中,双击 btnRemove 以打开包含 btnRemove_Click 事件的 Code Editor(代码编辑器)。 在 btnRemove_Click 方法中,添加以下代码:' Visual Basic' 调用 MyControlArray 的 Remove 方法。MyControlArray.Remove()// C#// 调用 MyControlArray 的 Remove 方法。MyControlArray.Remove();保存项目。 测试项目 从 Debug(调试)菜单中,选择 Start(开始)。 将打开 Form1,其中包含三个按钮,分别标为 Add Button(添加按钮)、Remove Button(删除按钮)和 Button 1(按钮 1)。 单击 Button 1(按钮 1)。 注意,屏幕将显示一个消息框,其中正确显示了索引。 单击几次 Add Button(添加按钮)按钮。 每单击一次都会向窗体添加一个新按钮。单击每个新按钮都将显示一个消息框,正确报告该按钮的索引。另外请注意,Button 0(按钮 0)的颜色已变为红色,这是由于 btnAdd_Click 事件中的以下行所导致的:MyControlArray(0).BackColor = System.Drawing.Color.Red单击几次 Remove Button(删除按钮)按钮。 每单击一次都会从窗体中删除一个按钮。 单击此按钮,直至删除窗体左侧的所有按钮。 再次单击 Add Button(添加按钮)按钮。 按钮将再次被添加到窗体中,并用正确的索引进行编号。 总结本文演示了如何创建封装控件数组功能的组件。其中包括如何创建方法以动态地在窗体中添加和删除控件,以及通过默认的属性或索引程序来公开对象。因为实现了所有功能,所以可以通过编写组件的自定义代码来扩展控件数组。
( 01:01:29)
( 01:01:27)
( 01:01:16)
( 11:16:38)
( 17:18:00)
( 10:50:00)
( 18:19:00)
( 10:18:00)
相关排行总榜1223人阅读
.NET,.NET(MSDN).VB,.NET.,.,..NET,,,.NET.FCL!.Button(MSDN.MSDN,MSDN),CollectionBase () ,..CollectionBase,ButtonArray.Button.:
namespace ButtonArrayProject{
&&&&&& using S
&&&&&& /// &summary&
&&&&&& /// ButtonArray
&&&&&& /// &/summary&
&&&&&& public class ButtonArray : System.Collections.CollectionBase{
&&&&&&&&&&&&& // ,
&&&&&&&&&&&&& private readonly System.Windows.Forms.Form HostF
&&&&&&&&&&&&& //
&&&&&&&&&&&&& public System.Windows.Forms.Button AddNewButton(){
&&&&&&&&&&&&&&&&&&&& //
&&&&&&&&&&&&&&&&&&&& System.Windows.Forms.Button aButton = new System.Windows.Forms.Button();
&&&&&&&&&&&&&&&&&&&& // (this)
&&&&&&&&&&&&&&&&&&&& this.List.Add(aButton);
&&&&&&&&&&&&&&&&&&&& //
&&&&&&&&&&&&&&&&&&&& HostForm.Controls.Add(aButton);
&&&&&&&&&&&&&&&&&&&& //
&&&&&&&&&&&&&&&&&&&& aButton.Top = Count * 25;
&&&&&&&&&&&&&&&&&&&& aButton.Left = 100;
&&&&&&&&&&&&&&&&&&&& // ButtonTag
&&&&&&&&&&&&&&&&&&&& aButton.Tag = this.C
&&&&&&&&&&&&&&&&&&&& aButton.Text = "Button " + this.Count.ToString();
&&&&&&&&&&&&&&&&&&&& //
&&&&&&&&&&&&&&&&&&&& aButton.Click += new System.EventHandler(ClickHandler);
&&&&&&&&&&&&&&&&&&&& //
&&&&&&&&&&&&&&&&&&&& return aB
&&&&&&&&&&&&& }
&&&&&&&&&&&&& //
&&&&&&&&&&&&& public void Remove(){
&&&&&&&&&&&&&&&&&&&& //
&&&&&&&&&&&&&&&&&&&& if(this.Count & 0){
&&&&&&&&&&&&&&&&&&&&&&&&&&& //
&&&&&&&&&&&&&&&&&&&&&&&&&&& // :
&&&&&&&&&&&&&&&&&&&&&&&&&&& this.HostForm.Controls.Remove(this[this.Count-1]);
&&&&&&&&&&&&&&&&&&&&&&&&&&& //
&&&&&&&&&&&&&&&&&&&&&&&&&&& this.List.RemoveAt(this.Count-1);
&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&& }
&&&&&&&&&&&&& //
&&&&&&&&&&&&& public void ClickHandler(Object sender, System.EventArgs e) {
&&&&&&&&&&&&&&&&&&&& // MessageBox
&&&&&&&&&&&&&&&&&&&& System.Windows.Forms.MessageBox.Show(" " +
&&&&&&&&&&&&&&&&&&&&&&&&&&& ((System.Windows.Forms.Button) sender).Tag.ToString());
&&&&&&&&&&&&& }
&&&&&&&&&&&&& //
&&&&&&&&&&&&& public ButtonArray(System.Windows.Forms.Form host){
&&&&&&&&&&&&&&&&&&&& //
&&&&&&&&&&&&&&&&&&&& this.HostForm =
&&&&&&&&&&&&&&&&&&&& //
&&&&&&&&&&&&&&&&&&&& this.AddNewButton();
&&&&&&&&&&&&& }
&&&&&&&&&&&&& // ()
&&&&&&&&&&&&& public System.Windows.Forms.Button this[int index]{
&&&&&&&&&&&&&&&&&&&& get{
&&&&&&&&&&&&&&&&&&&&&&&&&&& return (System.Windows.Forms.Button)this.List[index];
&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&& }
WinForm.Form1Button.Form1ButtonArray.Form1, :
using System.D
using System.C
using ponentM
using System.Windows.F
using System.D
namespace ButtonArrayProject
&&&&&& public class Form1 : System.Windows.Forms.Form{
&&&&&&&&&&&&& private ButtonArray btnA
&&&&&&&&&&&&& private System.Windows.Forms.Button btnA
&&&&&&&&&&&&& private System.Windows.Forms.Button btnR
&&&&&&&&&&&&& private ponentModel.Container components = null;
&&&&&&&&&&&&& public Form1(){
&&&&&&&&&&&&&&&&&&&& InitializeComponent();
&&&&&&&&&&&&&&&&&&&& this.btnArray = new ButtonArray(this);
&&&&&&&&&&&&& }
&&&&&&&&&&&&& protected override void Dispose( bool disposing ){
&&&&&&&&&&&&&&&&&&&& if( disposing )
&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&&& if (components != null)
&&&&&&&&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& components.Dispose();
&&&&&&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&& base.Dispose( disposing );
&&&&&&&&&&&&& }
&&&&&&&&&&&&& #region Windows
&&&&&&&&&&&&& private void InitializeComponent()&&&& {
&&&&&&&&&&&&&&&&&&&& this.btnAdd = new System.Windows.Forms.Button();
&&&&&&&&&&&&&&&&&&&& this.btnRemove = new System.Windows.Forms.Button();
&&&&&&&&&&&&&&&&&&&& this.SuspendLayout();
&&&&&&&&&&&&&&&&&&&& //
&&&&&&&&&&&&&&&&&&&& // btnAdd
&&&&&&&&&&&&&&&&&&&& //
&&&&&&&&&&&&&&&&&&&& this.btnAdd.Location = new System.Drawing.Point(352, 136);
&&&&&&&&&&&&&&&&&&&& this.btnAdd.Name = "btnAdd";
&&&&&&&&&&&&&&&&&&&& this.btnAdd.Size = new System.Drawing.Size(112, 23);
&&&&&&&&&&&&&&&&&&&& this.btnAdd.TabIndex = 0;
&&&&&&&&&&&&&&&&&&&& this.btnAdd.Text = "AddNewButton";
&&&&&&&&&&&&&&&&&&&& this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
&&&&&&&&&&&&&&&&&&&& //
&&&&&&&&&&&&&&&&&&&& // btnRemove
&&&&&&&&&&&&&&&&&&&& //
&&&&&&&&&&&&&&&&&&&& this.btnRemove.Location = new System.Drawing.Point(352, 192);
&&&&&&&&&&&&&&&&&&&& this.btnRemove.Name = "btnRemove";
&&&&&&&&&&&&&&&&&&&& this.btnRemove.Size = new System.Drawing.Size(112, 23);
&&&&&&&&&&&&&&&&&&&& this.btnRemove.TabIndex = 1;
&&&&&&&&&&&&&&&&&&&& this.btnRemove.Text = "RemoveButton";
&&&&&&&&&&&&&&&&&&&& this.btnRemove.Click += new System.EventHandler(this.btnRemove_Click);
&&&&&&&&&&&&&&&&&&&& //
&&&&&&&&&&&&&&&&&&&& // Form1
&&&&&&&&&&&&&&&&&&&& //
&&&&&&&&&&&&&&&&&&&& this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
&&&&&&&&&&&&&&&&&&&& this.ClientSize = new System.Drawing.Size(512, 381);
&&&&&&&&&&&&&&&&&&&& this.Controls.Add(this.btnRemove);
&&&&&&&&&&&&&&&&&&&& this.Controls.Add(this.btnAdd);
&&&&&&&&&&&&&&&&&&&& this.Name = "Form1";
&&&&&&&&&&&&&&&&&&&& this.Text = "Form1";
&&&&&&&&&&&&&&&&&&&& this.ResumeLayout(false);
&&&&&&&&&&&&& }
&&&&&&&&&&&&& #endregion
&&&&&&&&&&&&& [STAThread]
&&&&&&&&&&&&& static void Main() {
&&&&&&&&&&&&&&&&&&&& Application.Run(new Form1());
&&&&&&&&&&&&& }
&&&&&&&&&&&&& private void btnAdd_Click(object sender, System.EventArgs e) {
&&&&&&&&&&&&&&&&&&&& this.btnArray.AddNewButton();
&&&&&&&&&&&&&&&&&&&& this.btnArray[0].BackColor = Color.B
&&&&&&&&&&&&& }
&&&&&&&&&&&&& private void btnRemove_Click(object sender, System.EventArgs e) {
&&&&&&&&&&&&&&&&&&&& this.btnArray.Remove();
&&&&&&&&&&&&& }
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:145326次
积分:1863
积分:1863
排名:第8975名
原创:48篇
评论:148条
(4)(3)(1)(1)(1)(1)(3)(3)(1)(2)(1)(4)(2)(2)(1)(8)(9)(1)

我要回帖

更多关于 js创建数组 的文章

 

随机推荐