public override ComponentFactory CreateComponent(Components comp, int height, int width, int leftMargin, int topMargin, string content) { HTMLComponentFactory c = new HTMLComponentFactory(); switch (comp) { case Components.TextArea: c = new HTMLTextArea(height, width, leftMargin, topMargin, content); break; case Components.TextBox: c = new HTMLTextBox(height, width, leftMargin, topMargin, content); break; case Components.Label: c = new HTMLLabel(height, width, leftMargin, topMargin, content); break; case Components.Button: c = new HTMLButton(height, width, leftMargin, topMargin, content); break; default: break; } return(c); }
public static void Main(string[] args) { HTMLFactory factory = new HTMLFactory(); HTMLButton button1 = new HTMLButton { Width = 100, Height = 200, Top = 10, Left = 5, Content = "Content" }; factory.Components.Add(button1); factory.Execute(); }