Style 属性、Label 控件示例Style property, Label control example

下面的示例使用**Style** 属性指定**多页** 和**TabStrip** 中选项卡的外观。The following example uses the Style property to specify the appearance of the tabs in MultiPage and TabStrip. 本示例还演示了如何使用**标签This example also demonstrates using a Label. 用户通过选择选项按钮** 来选择样式。The user chooses a style by selecting an OptionButton.

若要使用此示例,请将此示例代码复制到窗体的 Declarations 部分。To use this example, copy this sample code to the Declarations portion of a form. 确保该窗体包含:Make sure that the form contains:

  • 一个名为"Label1"的 LabelA Label named Label1.
  • 三个名称分别为"OptionButton1"到"OptionButton3"的 OptionButton 控件。Three OptionButton controls named OptionButton1 through OptionButton3.
  • 一个名为"MultiPage1"的 MultiPageA MultiPage named MultiPage1.
  • 一个名为"TabStrip1"的 TabStripA TabStrip named TabStrip1.
  • TabStrip 中的任意控件。Any control inside the TabStrip.
  • MultiPage 的每个页中的任意控件。Any control in each page of the MultiPage.
Private Sub OptionButton1_Click() 
 MultiPage1.Style = fmTabStyleTabs 
 TabStrip1.Style = fmTabStyleTabs 
End Sub 
Private Sub OptionButton2_Click() 
 'Note that the page borders are invisible 
 MultiPage1.Style = fmTabStyleButtons 
 TabStrip1.Style = fmTabStyleButtons 
End Sub 
Private Sub OptionButton3_Click() 
 'Note that the page borders are invisible and 
 'the page body begins where the tabs normally 
 MultiPage1.Style = fmTabStyleNone 
 TabStrip1.Style = fmTabStyleNone 
End Sub 
Private Sub UserForm_Initialize() 
 Label1.Caption = "Page/Tab Style" 
 OptionButton1.Caption = "Tabs" 
 OptionButton1.Value = True 
 MultiPage1.Style = fmTabStyleTabs 
 TabStrip1.Style = fmTabStyleTabs 
 OptionButton2.Caption = "Buttons" 
 OptionButton3.Caption = "No Tabs or Buttons" 
End Sub

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.