The
ToolStripContainer
control contains a
ToolStripPanel
along each of its edges where a
ToolStrip
control can dock. The control’s center is filled with another
ToolStripPanel
that can contain other controls that are not part of the
The
Figure G-29 shows a form containing a ToolStripContainer with its Dock property set to Fill , so it fills the form. The lighter area in the middle is a PictureBox sitting inside the middle ToolStripPanel , also with its Dock property set to Fill.
Figure G-29:
The ToolStripContainer control lets the user rearrange ToolStrip controls at runtime.
The ToolStripContainer holds five ToolStrip controls positioned in the container’s various edge panels. The ToolStrip3 control’s TextDirection property is set to Vertical90 , so it sits along the right edge of the form. The ToolStrip1 and ToolStrip2 controls have been dragged into two rows at the top of the form. The ToolStrip1 and ToolStrip2 controls share a row at the bottom.
The control’s LeftToolStripPanel , RightToolStripPanel , TopToolStripPanel , BottomToolStrip?Panel , and ContentPanel properties contain references to the ToolStripPanel controls that this control contains. Its LeftToolStripPanelVisible , RightToolStripPanelVisible , TopToolStripPanel?Visible , and BottomToolStripPanelVisible properties let you show or hide specific panels. For example, you can hide the bottom or side panels if you don’t want the user to drag ToolStrip s there.
The
ToolStripContainer
control’s other properties are relatively straightforward. See the online help (
msdn2.microsoft.com/library/system.
The
ToolTip
component allows you to provide tooltip help when the
The following table describes the ToolTip component’s most useful properties.
Open table as spreadsheet
|
Property |
Purpose |
|---|---|
|
Active |
Determines whether the component displays tooltips. |
|
AutomaticDelay |
Sets the AutoPopDelay , InitialDelay , and ReshowDelay properties to values that are appropriate for this value. |
|
AutoPopDelay |
The number of
|
|
BackColor |
Determines the tooltip’s background
|
|
ForeColor |
Determines the tooltip’s foreground color. |
|
InitialDelay |
The number of milliseconds that the mouse must
|
|
IsBalloon |
Determines whether the tooltip is displayed as a balloon rather than a rectangle. |
|
OwnerDraw |
Determines whether your code will draw the tooltip. If you set this to True , catch the ToolTip component’s Draw method and draw the tooltip. Parameters to the method give the Graphics object to use, the bounds of the area to draw, and the tooltip text. This property is ignored if IsBalloon is True . |
|
ReshowDelay |
The number of milliseconds before the
|
|
ShowAlways |
Determines whether the component still displays tooltips, even if the form does not have the focus. The mouse still must hover over the tooltip area as usual if ShowAlways is True . |
|
StripAmpersands |
Determines whether the component
|
|
UseAnimation |
Determines whether animation effects are used to show and hide the tooltip. |
|
UseFading |
Determines whether fading effects are used to show and hide the tooltip. |
The ToolTip component’s SetToolTip method lets a program associate a tooltip with a code at runtime. The following code adds tooltip text to several address controls:
ttHint.SetToolTip(txtFirstName, "Customer first
name
")
ttHint.SetToolTip(txtLastName, "Customer last name")
ttHint.SetToolTip(txtStreet, "Mailing address street number and name")
ttHint.SetToolTip(txtCity, "Mailing address city")
ttHint.SetToolTip(cboState, "Mailing address state")
ttHint.SetToolTip(txtZip, "Mailing address ZIP code")
The following table lists the
ToolTip
component’s most useful
Open table as spreadsheet
|
Method |
Purpose |
|---|---|
|
GetToolTip |
Returns a control’s associated tooltip text. |
|
RemoveAll |
Removes all tooltip text associated with this ToolTip component. |
|
SetToolTip |
Sets a control’s associated tooltip text. Set the text to Nothing or an empty string to remove that control’s tooltip text. |
|
Show |
Displays a tooltip over a specific control. Different overloaded versions let you specify the tooltip’s location and duration. |