WebPartZoneBase.RestoreVerb 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得 WebPartVerb 物件的參考,這個物件可讓使用者將區域中的 WebPart 控制項還原為標準大小。
public:
virtual property System::Web::UI::WebControls::WebParts::WebPartVerb ^ RestoreVerb { System::Web::UI::WebControls::WebParts::WebPartVerb ^ get(); };
[System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)]
public virtual System.Web.UI.WebControls.WebParts.WebPartVerb RestoreVerb { get; }
[<System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)>]
member this.RestoreVerb : System.Web.UI.WebControls.WebParts.WebPartVerb
Public Overridable ReadOnly Property RestoreVerb As WebPartVerb
屬性值
WebPartVerb,可讓使用者還原 WebPart 控制項。
- 屬性
範例
下列程式代碼範例示範 RestoreVerb 在控件上使用 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) 。 請注意,區域中的宣告式 <RestoreVerb>
元素會設定屬性文字的值 Description
,當使用者將滑鼠指標放在動詞功能表中的動詞上方時,它會顯示為 ToolTip。
<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
至頁面。 使用最小化動詞將控件最小化,並注意還原動詞變成可見。 您可以使用複選框來啟用和停用還原動詞。
備註
當控件最小化時,屬性所 RestoreVerb 參考的還原動詞命令會出現在區域中每個 WebPart 控件的動詞功能表內。 動詞會顯示在所有頁面顯示模式的功能表中。
還原控件會在先前最小化控件之後,將其展開回正常大小。