Winform 2.0中的Strip控件

http://msdn.microsoft.com/msdnmag/issues/05/05/EnhancedWindowsForms/default.aspx
including MenuStrip, ToolStrip, StatusStrip, and ContextMenuStrip
Figure 9 Strip Controls

The new strip controls improve on MainMenu, ToolBar, StatusBar, and ContextMenu in several key ways, including:

  • A consistent API to all strip controls
  • Improved design-time experience
  • Allowing adjacent strip controls to be repositioned with respect to one another, as well as repositioned to the top, right, bottom, and left of the host form's client area
  • Contemporary look of Office 2003 and Windows themes
  • Ability to host a rich set of child controls, such as dropdown lists, labels, menus, and textboxes
  • Rendering support that simplifies custom painting coding

While MainMenu, ToolBar, StatusBar, and ContextMenu are not included by default in the Visual Studio Toolbox, they are still included in the .NET Framework, primarily for backwards compatibility. Of course, the strip controls are located on the Toolbox so you can easily drag them onto your form. Through the Designer, you can add a variety of controls to each strip control

Figure 10 Controls Hosted by Strip Control

Strip ControlDesigner-Allowed Strip Item Controls
MenuStripToolStripMenuItem (for both top menu and submenu items)
ToolStripComboBox
ToolStripTextBox
ToolStripSeparator (for submenus)
ContextMenuStripSame as MenuStrip
ToolStripToolStripButton
ToolStripComboBox
ToolStripSplitButton
ToolStripLabel
ToolStripSeparator
ToolStripDropDownButton
ToolStripTextBox
ToolStripProgressBar
StatusStripToolStripStatusLabel
ToolStripProgressBar
ToolStripDropDownButton
ToolStripSplitButton

Figure 11  Key Strip Control Property Configurations

PropertyDescription
AllowItemReorderUsers can reposition strip items by setting this property to True. The user needs to press Alt before repositioning (not for ContextMenuStrip).
ShowItemToolTipsSets whether strip items can also display tool tips (not for MenuStrip or Context MenuStrip).
DockSpecifies the form edge to line the strip control up against or fill.
RenderModeStrip controls support three render modes:
System: rendered with colors from the system palette.
Professional: rendered according to the current Windows Color Scheme—Blue, Olive Green, or Silver.
ManagerRenderMode: rendered using the Windows Theme sensitive ToolStripRenderer and is the default.
Custom is currently unsupported.
SizingGripSpecifies whether the form sizing grip should be shown or hidden (StatusStrip only).
GripStyleSpecifies whether a MenuStrip or ToolStrip displays a grip allowing it to be repositioned.
CanOverflowWhen the form becomes narrower than a strip control, this option specifies how to visually represent strip items that are hidden by the overlap, either hidden if False or accessible via a dropdown at the end of the strip control if True.

Figure 12 Key Strip Item Control Property Configurations

PropertyDescription
DisplayStyleSpecifies what to display; values include None, Text, Image, and ImageAndText.
TextImageRelationSets the position of text in relation to an image. Applied when DisplayStyle is ImageAndText.
ImageScalingSpecifies how an image is rendered, either ShrinkToFit or None.
AlignmentDetermines which end of a strip control a strip item control will align to, either Head or Tail (Left or Right sides, respectively, when rendering left-to-right).
OverflowDetermines how each strip item control responds to overflow. Can be either Never, Always, or AsNeeded, which leaves the decision up to the host strip control.

Figure 16 Key MaskedTextBox Properties

PropertyDescription
HidePromptOnLeaveTrue by default but, if set to False, ensures that prompt characters are always visible.
PromptCharUsed to change the prompt character. Underscore by default.
AllowPromptAsInputIn some cases, your prompt character may also be a valid value and setting AllowPromptAsInput to True allows this when neither can be reasonably changed.
IncludeLiteralsSpecifies whether to include literal character values in MaskedTextBox's Text property.
IncludePromptsSpecifies whether to include prompt character values in MaskedTextBox's Text property.
ResetOnPromptIf True, when a prompt is entered, a prompt is inserted and values on the right-hand side are shifted right.
ResetOnSpaceIf True, when a space is entered, a space is inserted and values on the right-hand side are shifted right.

转载于:https://www.cnblogs.com/chinapro/archive/2005/04/17/139132.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值