Chapter 3. Designer Basics

IN THIS CHAPTER

A control designer defines the behavior and UI presentation of a control during design-time. In VS .NET, forms can be created using the Forms Designer. This Forms Designer allows controls, such as buttons, menus, and toolbars, to be drawn on the form rather than being created pragmatically. Each control has an associated designer that defines the behavior of the control during the visual design-time process of building a Windows Forms application.

During design-time, a control's properties can be manipulated using the Property Grid. The control should appear very similar to the runtime look while being designed, with a few exceptions. These exceptions include the handling of a control's Visible property and any designer clues such as the placement grid. The placement grid is the series of dots used for aligning controls during design-time that are not shown at runtime. In general, however, a control's appearance during design-time should give an accurate representation of the control's appearance during runtime.

Note

Certainly, setting the control's Visible property to false during design-time should not make the control invisible. If this were the case, there would be no way to select the control and continue to visually design it.


Designers are an important part of the equation in developing custom controls. By providing a rich design-time experience, application developers can visually build applications using the custom control you've created. The UI presentation is not a designer's sole responsibility; designers must also provide for proper serialization of the code generated for the control, in order for the control to work properly at runtime. The code for the construction of the control, along with the necessary property settings, is serialized within the InitializeComponent method of the form hosting the control. This is the reason for the all-too-familiar comment on the method stating, “This code should not be modified as the designer will OVER WRITE this method when serializing the form's design state.”

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.94.79