WebPart.AllowMinimize 属性

定义

获取或设置一个值,该值指示最终用户是否可以最小化 WebPart 控件。Gets or sets a value indicating whether end users can minimize a WebPart control.

public:
 virtual property bool AllowMinimize { bool get(); void set(bool value); };
[System.Web.UI.Themeable(false)]
[System.Web.UI.WebControls.WebParts.Personalizable(System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared)]
public virtual bool AllowMinimize { get; set; }
member this.AllowMinimize : bool with get, set
Public Overridable Property AllowMinimize As Boolean

属性值

如果可以最小化 WebPart 控件,则为 true;否则为 falsetrue if the WebPart control can be minimized; otherwise, false. 默认值为 trueThe default value is true.

属性

示例

下面的代码示例演示如何更改自定义 Web 部件控件的 AllowMinimize 属性的默认设置,以便用户无法将控件最小化。The following code example demonstrates how to change the default setting of the AllowMinimize property for a custom Web Parts control, so that the control cannot be minimized by a user. 本示例假定使用自定义 WebPart 控件 TextDisplayWebPart,该控件在 WebPart 类概述的 "示例" 部分中找到。This example assumes the use of a custom WebPart control, TextDisplayWebPart, which is found in the Example section of the WebPart class overview.

在网页的声明性标记中,在引用控件的 <aspSample:TextDisplayWebPart> 元素上,记下 AllowMinimize="false" 属性,该属性隐藏 WebPart 控件的谓词菜单中的最小化谓词,并阻止用户最小化控件。In the declarative markup for the Web page, on the <aspSample:TextDisplayWebPart> element that references the control, note the AllowMinimize="false" attribute, which hides the minimize verb in the WebPart control's verbs menu, and prevents a user from being able to minimize the control. 在浏览器中加载页面,然后单击 WebPart 控件上的谓词菜单。Load the page in a browser, and click the verbs menu on the WebPart control. 由于在该控件的声明性标记中禁用了 "最小化" 谓词,该谓词通常出现在谓词菜单上。The minimize verb, which would normally be present on the verbs menu, is hidden because you disabled it in the declarative markup for the control.

<%@ page language="C#" %>
<%@ register tagprefix="aspSample" 
             Namespace="Samples.AspNet.CS.Controls" 
             Assembly="TextDisplayWebPartCS"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
  <form id="Form1" runat="server">
    <asp:webpartmanager id="WebPartManager1" runat="server" />
    <asp:webpartzone
      id="WebPartZone1"
      runat="server"
      title="Zone 1"
      PartChromeType="TitleAndBorder">
        <parttitlestyle font-bold="true" ForeColor="#3300cc" />
        <partstyle
          borderwidth="1px"   
          borderstyle="Solid"  
          bordercolor="#81AAF2" />
        <zonetemplate>
          <aspSample:TextDisplayWebPart 
            runat="server"   
            id="textwebpart" 
            title = "Text Content WebPart" 
            AllowMinimize="false" />
        </zonetemplate>
    </asp:webpartzone>
  </form>
</body>
</html>
<%@ page language="VB" %>
<%@ register tagprefix="aspSample" 
             Namespace="Samples.AspNet.VB.Controls" 
             Assembly="TextDisplayWebPartVB"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
  <form id="Form1" runat="server">
    <asp:webpartmanager id="WebPartManager1" runat="server" />
    <asp:webpartzone
      id="WebPartZone1"
      runat="server"
      title="Zone 1"
      PartChromeType="TitleAndBorder">
        <parttitlestyle font-bold="true" ForeColor="#3300cc" />
        <partstyle
          borderwidth="1px"   
          borderstyle="Solid"  
          bordercolor="#81AAF2" />
        <zonetemplate>
          <aspSample:TextDisplayWebPart 
            runat="server"   
            id="textwebpart" 
            title = "Text Content WebPart" 
            AllowMinimize="false" />
        </zonetemplate>
    </asp:webpartzone>
  </form>
</body>
</html>

注解

如果设置为 "false",则 AllowMinimize 属性会阻止最终用户最小化控件,并且控件的标题栏中不显示控件的最小化用户界面(UI)。The AllowMinimize property, if set to false, prevents an end user from being able to minimize the control, and the user interface (UI) for minimizing the control does not appear in the control's title bar. 在 Web 部件术语中,当 AllowMinimize 属性设置为 false时,控件的谓词菜单上不会显示最小化谓词。In Web Parts terminology, when the AllowMinimize property is set to false, the minimize verb does not appear on the control's verbs menu.

当用户最小化控件时,它会将控件的大小减小到仅显示控件标题栏和标题部分的最小区域。When a user minimizes a control, it reduces the control's size down to a minimal area that displays only part of the control's title bar and title.

无法通过主题或样式表主题设置此属性。This property cannot be set by themes or style sheet themes. 有关详细信息,请参阅 ThemeableAttributeASP.NET 主题和外观For more information, see ThemeableAttribute and ASP.NET Themes and Skins.

此属性的个性化设置范围设置为 Shared,只能由授权用户修改。The personalization scope of this property is set to Shared and can be modified only by authorized users. 有关详细信息,请参阅 PersonalizableAttributeWeb 部件个性化概述For more information, see PersonalizableAttribute and Web Parts Personalization Overview.

适用于

另请参阅