共用方式為


WebPartZoneBase.MinimizeVerb 屬性

定義

取得 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 ,當使用者將滑鼠指標放在動詞功能表中的動詞上方時,它會顯示為 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 至頁面。 您可以使用複選框來啟用和停用控制元件上的 TextDisplayWebPart 最小化動詞。 啟用動詞時,您也可以按兩下它,將控制件最小化。

備註

屬性所參考的 MinimizeVerb 最小化動詞會顯示在區域中每個 WebPart 控件的動詞功能表。 動詞會顯示在所有頁面顯示模式中。

將控件向下折迭到較小的大小、只讓控件的標題列可見,並在標題列中顯示還原動詞。

適用於

另請參閱