C#&.NET Winform桌面应用程序中如何动态生成控件并添加事件呢?
1.63K 次浏览
如题,在C#&.NET Winform桌面应用程序中如何动态生成控件并添加事件呢?
假如当前有一个Doctor
类:
public class Doctor
{
public Doctor()
{
Appointments = new List();
}
public int Id { get; set; }
public string Name { get; set; }
public List Appointments { get; set; }
}
和List
集合:
var _doctors = new List
{
new Doctor{Id = 1,Name = "Doctor(1)"},
new Doctor{Id = 2,Name = "Doctor(2)"},
new Doctor{Id = 3,Name = "Doctor(3)"}
};
如何实现循环List
集合动态生成每个医生的预约列表界面以及为医生绑定预约事件呢?