Dynamic Interfaces and Layout Engines
One of the most common questions in any Windows programming language is how to add a control to a window dynamically—in other words, while the program is executing. For example, you might want to create a program that generates tailored forms based on the information in an XML file. This sort of task is surprisingly easy in .NET, because there isn’t a sharp distinction between control creation at runtime and control creation at design time. In fact, in .NET programming, every control is created through code. As you learned in Chapter 1, when you add a control to a form and configure its properties, Visual Studio generates the appropriate code statements and adds them to a designer file. By studying this automatically generated code, you can quickly learn how to create and add any control you need at runtime.
KeywordsChild Control Visual Studio Event Handler Control Collection Container Control
Unable to display preview. Download preview PDF.