WebPartZoneBase.MinimizeVerb 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取对 WebPartVerb 对象的引用,该对象使最终用户能够最小化区域中的 WebPart 控件。
public:
virtual property System::Web::UI::WebControls::WebParts::WebPartVerb ^ MinimizeVerb { System::Web::UI::WebControls::WebParts::WebPartVerb ^ get(); };
[System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)]
public virtual System.Web.UI.WebControls.WebParts.WebPartVerb MinimizeVerb { get; }
[<System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)>]
member this.MinimizeVerb : System.Web.UI.WebControls.WebParts.WebPartVerb
Public Overridable ReadOnly Property MinimizeVerb As WebPartVerb
属性值
使最终用户能够最小化 WebPartVerb 控件的 WebPart。
- 属性
示例
下面的代码示例演示如何在 MinimizeVerb 控件上使用 WebPartZone 属性。 若要使代码示例正常工作,需要 属性的 Example 节 HelpVerb 中的所有代码。
代码示例的以下部分来自分部类,并包含切换是启用或禁用最小化谓词的代码。
protected void CheckBoxList1_SelectedItemIndexChanged(Object sender, EventArgs e)
{
foreach (ListItem item in CheckBoxList1.Items)
{
WebPartVerb theVerb;
switch (item.Value)
{
case "close":
theVerb = WebPartZone1.CloseVerb;
break;
case "export":
theVerb = WebPartZone1.ExportVerb;
break;
case "delete":
theVerb = WebPartZone1.DeleteVerb;
break;
case "minimize":
theVerb = WebPartZone1.MinimizeVerb;
break;
case "restore":
theVerb = WebPartZone1.RestoreVerb;
break;
default:
theVerb = null;
break;
}
if (item.Selected)
theVerb.Enabled = true;
else
theVerb.Enabled = false;
}
}
Protected Sub CheckBoxList1_SelectedItemIndexChanged(ByVal sender As [Object], ByVal e As EventArgs)
Dim item As ListItem
For Each item In CheckBoxList1.Items
Dim theVerb As WebPartVerb
Select Case item.Value
Case "close"
theVerb = WebPartZone1.CloseVerb
Case "export"
theVerb = WebPartZone1.ExportVerb
Case "delete"
theVerb = WebPartZone1.DeleteVerb
Case "minimize"
theVerb = WebPartZone1.MinimizeVerb
Case "restore"
theVerb = WebPartZone1.RestoreVerb
Case Else
theVerb = Nothing
End Select
If item.Selected Then
theVerb.Enabled = True
Else
theVerb.Enabled = False
End If
Next item
End Sub
代码示例的另一部分是承载自定义 WebPart 控件并包含用户界面 (UI) 的网页。 请注意,区域中的声明性 <MinimizeVerb>
元素设置属性文本的值 Description
,当用户将鼠标指针置于谓词菜单中的谓词上时,该属性文本显示为工具提示。
<asp:WebPartZone ID="WebPartZone1" Runat="server">
<CloseVerb Text="Close WebPart" />
<HelpVerb Text="View Help" />
<ExportVerb Text="Export WebPart Definition" />
<DeleteVerb Text ="Delete WebPart" />
<MinimizeVerb Description="Minimize the control" />
<RestoreVerb Description="Restore the control" />
<ZoneTemplate>
</ZoneTemplate>
</asp:WebPartZone>
<asp:WebPartZone ID="WebPartZone1" Runat="server">
<CloseVerb Text="Close WebPart" />
<HelpVerb Text="View Help" />
<ExportVerb Text="Export WebPart Definition" />
<DeleteVerb Text ="Delete WebPart" />
<MinimizeVerb Description="Minimize the control" />
<RestoreVerb Description="Restore the control" />
<ZoneTemplate>
</ZoneTemplate>
</asp:WebPartZone>
在浏览器中加载页面后,将页面切换到目录显示模式,并将控件添加到 TextDisplayWebPart
页面(如果尚未添加)。 可以使用复选框在控件上 TextDisplayWebPart
启用和禁用最小化谓词。 启用谓词后,还可以单击它以最小化控件。
注解
属性引用的 MinimizeVerb 最小化谓词显示在区域中每个 WebPart 控件的谓词菜单中。 谓词在所有页面显示模式下显示。
最小化控件会将其折叠为较小的大小,仅使控件的标题栏可见,并使还原谓词在标题栏中可见。