日期:2014-05-17 浏览次数:20876 次
Control c = null;
switch(controlType.ToUpper())
{
case "BUTTON": c = new Button(); break;
case "TEXTBOX": c = new TextBox(); break;
case "LABEL": c = new Label(); break;
default: throw new Exception("Unrecognized control type: " + controlType);
}
c.Text = controlText;
...