lalu tambahkan sebuak Button dan klik dua kali atau ke properties dan tambah event click.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace controlruntime
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
Button btn = new Button();
btn.Click += new EventHandler(btn_kilk);
btn.Location = new System.Drawing.Point(100, 10);
btn.Name = "button x";
btn.Size = new System.Drawing.Size(100, 23);
btn.TabIndex = 0;
btn.Text = "button runtime";
btn.UseVisualStyleBackColor = true;
Controls.Add(btn);
}
void btn_kilk(object sender, EventArgs e)
{
Button btn = new Button();
btn.Location = new System.Drawing.Point(2, 184);
btn.Name = "button z";
btn.Size = new System.Drawing.Size(170, 23);
btn.TabIndex = 0;
btn.Text = "button runtime ke dua";
btn.UseVisualStyleBackColor = true;
Controls.Add(btn);
}
}
}
maka hasilnya akan seperti ini:
Full Project DISINI
0 komentar:
Post a Comment