WebPartZoneBase.MenuVerbHoverStyle 属性

定义

获取在最终用户将鼠标指针定位在谓词下拉菜单中的某个谓词之上时该谓词的外观的样式信息。Gets style information for the appearance of a verb in a verbs drop-down menu when an end user positions the mouse pointer over the verb.

public:
 property System::Web::UI::WebControls::Style ^ MenuVerbHoverStyle { System::Web::UI::WebControls::Style ^ get(); };
[System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)]
public System.Web.UI.WebControls.Style MenuVerbHoverStyle { get; }
member this.MenuVerbHoverStyle : System.Web.UI.WebControls.Style
Public ReadOnly Property MenuVerbHoverStyle As Style

属性值

包含在用户将鼠标指针定位在某个谓词之上时该谓词的样式信息的 StyleA Style that contains style information for a verb when a user positions the mouse pointer over the verb.

属性

示例

下面的代码示例演示了 WebPartZone 控件上 MenuVerbHoverStyle 属性的声明性用法。The following code example demonstrates the declarative use of the MenuVerbHoverStyle property on a WebPartZone control. 有关完整的代码示例,包括代码隐藏源文件和包含此代码中区域的 .aspx 页面,请参阅 WebPartZoneBase 类概述。For the full code example, including the code-behind source file and the .aspx page that contains the zone in this code, see the WebPartZoneBase class overview.

请注意,在声明性标记中,MenuVerbHoverStyle 属性有一个分配给它的值。Notice that the MenuVerbHoverStyle property has a value assigned to it in the declarative markup. 此值会影响 WebPartZone2This value impacts WebPartZone2. 将页面加载到浏览器中后,将页面切换到编辑模式。After you load the page into a browser, switch the page into edit mode. 单击谓词菜单,可看到 WebPartZone2 中控件上的谓词菜单的背景色是声明性标记中分配给它的颜色。Click the verbs menu, and notice that the background color for the verbs menu on the control in WebPartZone2 is the color assigned to it in the declarative markup.

<asp:WebPartZone 
  ID="WebPartZone2"
  Runat="server" 
  DragHighlightColor="#00ff00"
  AllowLayoutChange="true"
  EmptyZoneText="Add WebParts to this empty Zone."
  BorderWidth="2"
  BorderColor="DarkBlue"
  BorderStyle="Dashed" 
  MenuLabelText="Verbs Menu" 
  MenuPopupImageUrl="label.gif" >
  <VerbStyle Font-Italic="true" />
  <MenuLabelStyle BackColor="Lime" BorderWidth="1"  />
  <MenuLabelHoverStyle Font-Bold="true" />
  <MenuVerbHoverStyle BackColor="LightGrey" />
  <MenuVerbStyle Font-Italic="true" /> 
  <ZoneTemplate>
    <asp:Label ID="Label1" Runat="server" Title="Date" />
  </ZoneTemplate>
</asp:WebPartZone>
<asp:WebPartZone 
  ID="WebPartZone2"
  Runat="server" 
  DragHighlightColor="#00ff00"
  AllowLayoutChange="true"
  EmptyZoneText="Add WebParts to this empty Zone."
  BorderWidth="2"
  BorderColor="DarkBlue"
  BorderStyle="Dashed" 
  MenuLabelText="Verbs Menu" 
  MenuPopupImageUrl="label.gif" >
  <VerbStyle Font-Italic="true" />
  <MenuLabelStyle BackColor="Lime" BorderWidth="1"  />
  <MenuLabelHoverStyle Font-Bold="true" />
  <MenuVerbHoverStyle BackColor="LightGrey" />
  <MenuVerbStyle Font-Italic="true" /> 
  <ZoneTemplate>
    <asp:Label ID="Label1" Runat="server" Title="Date" />
  </ZoneTemplate>
</asp:WebPartZone>

注解

当用户将鼠标指针置于某个谓词上时,MenuVerbHoverStyle 属性中包含的样式信息将应用于谓词菜单中的单个谓词。The style information contained in the MenuVerbHoverStyle property applies to an individual verb in a verbs menu, when a user positions a mouse pointer over one of the verbs.

尽管此属性是只读的,但你可以设置基础 Style 对象的样式属性。Although this property is read-only, you can set the style attributes of the underlying Style object.

由于包含谓词的菜单是使用 Microsoft Internet Explorer 的弹出对象创建的,因此,当您将鼠标指针放在具有不同文本长度的谓词上时,菜单将不会正确呈现边框。Because the menu that contains the verbs is created using Microsoft Internet Explorer's pop-up object, the menu does not correctly render its border when you place your mouse pointer over verbs that have different text lengths. 此操作的最佳解决方法是声明一个包含不可见边框的 <MenuVerbHoverStyle> 元素,因此所有谓词的菜单宽度都是完全相同的。The best workaround for this is to declare a <MenuVerbHoverStyle> element with an invisible border, so the menu width for all verbs is exactly the same size. 声明性元素会出现在区域内,如下所示:The declarative element would occur within a zone, and would look as follows:

<asp:WebPartZone ID="WebPartZone1" runat="server">  
  <MenuVerbHoverStyle BorderStyle="Solid" BorderWidth="1px"       BorderColor="White" />  
  <ZoneTemplate>  
      <asp:Button ID="Button1" runat="server" Text="Button" />  
  </ZoneTemplate>  
</asp:WebPartZone>  

适用于

另请参阅