SETTING DESIGNER OPTIONS

When you first install Visual Studio, the Windows Forms Designer is configured to be quite usable. You can open a form immediately and use the Toolbox to place controls on it. You can use the mouse to move and resize controls. You can use the Format menu to arrange and size controls. Overall the Windows Forms Designer provides a first-class intuitive WYSIWYG (“what you see is what you get”) experience.

Behind the scenes, however, there are a few configuration options that control the designer’s behavior and that you should know about to get the most out of the designer.

To view the designer’s options, open the Tools menu, select Options, open the Windows Forms Designer branch, and select the General page to display the dialog box shown in Figure 3-1.

FIGURE 3-1: This dialog box lets you control the Windows Forms Designer’s behavior.

image

The following list describes the most important of these settings:

  • Optimized Code Generation — Determines whether Visual Studio generates optimized code. This setting is here instead of some more code-oriented part of the Options dialog box because some controls may be incompatible with code optimization.
  • Grid Size — Determines the horizontal and vertical dimensions of the sizing grid for use when LayoutMode is SnapToGrid.
  • LayoutMode — Determines whether Visual Studio uses snap-to-grid or snap lines. If this is SnapToGrid, objects automatically snap to the nearest grid point when you drag or resize them. When this is SnapLines, resized controls automatically snap to lines that align with the edges or centers of other controls, or with the form’s margins. Both of these options make it easy to build controls that are consistently sized and that align along their edges. The two options have a very different feel, however, so you might want to experiment with both to see which one you like best.
  • Automatically Open Smart Tags — Determines whether Visual Studio displays smart tags by default.
  • EnableRefactoringOnRename — Determines whether Visual Studio performs refactoring when you rename a control. (Refactoring is the process of restructuring the code, hopefully to make it better.) If this setting is True and you change a control’s name, Visual Studio updates any code that uses that control so it uses the new name. If this setting is False and you rename a control, any code that refers to the control still uses its old name, so the code will no longer work.
  • AutoToolboxPopulate — Determines whether Visual Studio adds components built by the solution to the Toolbox window.

USEFUL OPTIONS
Which LayoutMode you should use is a matter of preference. I know many developers who use each style. The EnableRefactoringOnRename option can save you a lot of trouble when you rename controls, so it’s almost always worth leaving the setting as True.

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

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