Further Notes on Writing Component Code

Because the component has no visual aspect to it, you don’t have the layout and formatting features that you see with the Windows Forms Designer. However, the concept of drag-and-drop programming is alive and well. Visual Studio, behind the scenes, injects the code to programmatically add the given class to the component’s container. From there, you can edit the various objects’ properties, double-click an object to get to its code, and so on.

When you drag the timer and process objects over from the Toolbox, Visual Studio aggregates these objects into the component by automatically writing the code shown in Listing 6.2.

LISTING 6.2 Component Designer–Generated Code

namespace ...

Get Microsoft Visual Studio 2015 Unleashed, Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.