70-526 MCTSModify control properties at design timeOnce you have placed a control on a Form or Container, you will more often than not
want to change some aspect of how the control looks. These properties of a control can be modifed
through the use of the Properties Window, Smart Tags Properties WindowThe main method of setting control properties is through the use of the Properties Window. ![]() Most of the properties of an object are exposed within this window, and can be set by either typing a new value, or selecting one of a set of predefined values. Some properties have special graphical interfaces, like choosing a colour. To open the Properties Window, choose Properties from the View menu, or press F4. Two of these special graphical interfaces that are worth mentioning are for the Dock and Anchor properties. Note The Anchor PropertyThe Anchor property defines an anchor position for the control. When a control is anchored to a form and the form is resized, the control maintains the distance between the control and the anchor positions. You can anchor a control to one or more edges of its container using a bitwise combination of the AnchorStyles values. The default is Top and Left. To anchor a control to a form do the following:
If the control is anchored to opposite edges of its container (for example, to the Top and Bottom), it stretches when the container resizes. If a control has its Anchor property set to None, the control moves half of the distance that the container of the control is resized. The Dock PropertyThe Dock property defines which control borders are docked to its parent control and determines how a control is resized with its parent. Docking is controlled using the DockStyle enumeration. The default is None. To dock a control in a form do the following:
The control is automatically resized to fit the boundaries of the docked edge. Note Smart tagsWhen you place some controls such as a Panel, TabControl, FlowLayoutPanel,
etc on a Form, they expose some of the common tasks through Smart Tags. Controls that do this
show a Smart Tag icon ![]() Document Outline WindowThis window provides a hierarchical view of all the controls on a form, including those that might not be visible or easily selectable. When you select a given control in the Document Outline Window, it is also selected in the Design Window, even if it is not currently visible. For example, if the item you select in the Document Outline Window is a sub-sub-menu item, the menustrip in the Designer will expand to show you the control. To open the Document Outline Window, do the following:
![]() Above you can see the hierarchy of the controls with the Design View. Controls can be dragged from one container to another within the Window. You can also delete controls by selecting them and pressing the DELETE key. If you want to add a control to the Document Outline Window, then select the control in the Toolbox, right-click and choose copy, then paste the control into the appropriate container in the Document Outline Window. Tab orderingThe tab order of a Form is the order in which a user moves focus from one control to another when pressing the TAB key. By default, the tab order is the same as the order in which you placed the controls on the Form. Every control that can receive focus is configured to have the TabStop property set to True. To remove a control from the tab order sequence, set the TabStop property to False. To set the tab order of a control, do the following:
Flat styleSome controls can change their appearance through the use of the FlatStyle property.
MSDN references
|