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; using WinFormControl; namespace Test { public partial class Form2 : Form { public Form2() { InitializeComponent(); for (var i = 0; i < 10; i++) { var btn = new TBtn() { Text = "鲜品白条一级", Width = 90, Height = 55, Margin = new Padding(8, 14, 8, 0), }; flowLayoutPanel1.Controls.Add(btn); } for (var i = 0; i < 10; i++) { var btn = new UButton() { Text = "鲜品白条一级", Width = 90, Height = 55, Margin = new Padding(8, 14, 8, 0), WithStataHode = true }; if (i % 3 == 0) btn.AsClicked = true; if (i == 5) { btn.WithStataHode = true; btn.Click += delegate { System.Threading.Thread.Sleep(2000); }; } if (i == 8) { btn.WithStataHode = true; btn.Click += delegate { throw new Exception("error"); }; } flowLayoutPanel2.Controls.Add(btn); } } } }