MenuItemStyle.HorizontalPadding Eigenschap

Definitie

Hiermee haalt u de hoeveelheid ruimte op links en rechts van de tekst van het menu-item op of stelt u deze in.

public:
 property System::Web::UI::WebControls::Unit HorizontalPadding { System::Web::UI::WebControls::Unit get(); void set(System::Web::UI::WebControls::Unit value); };
public System.Web.UI.WebControls.Unit HorizontalPadding { get; set; }
member this.HorizontalPadding : System.Web.UI.WebControls.Unit with get, set
Public Property HorizontalPadding As Unit

Waarde van eigenschap

De hoeveelheid ruimte (in pixels) links en rechts van de tekst van het menu-item. De standaardwaarde is 0.

Uitzonderingen

De geselecteerde waarde is van het type Percentage.

– of –

De geselecteerde waarde is kleiner dan 0.

Voorbeelden

In het volgende codevoorbeeld ziet u hoe u de HorizontalPadding eigenschap gebruikt om de horizontale afstand rond de tekst van een menu-item met 10 pixels te voltooien.


<%@ Page Language="C#" %>

<!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 runat="server">
    <title>MenuItemStyle HorizontalPadding Example</title>
</head>
<body>
    <form id="form1" runat="server">
    
      <h3>MenuItemStyle HorizontalPadding Example</h3>
      
      <asp:menu id="NavigationMenu"
        staticdisplaylevels="2"
        staticsubmenuindent="10" 
        orientation="Vertical"
        runat="server">
        
        <staticmenuitemstyle horizontalpadding="10"
          backcolor="LightBlue"/>
        <dynamicmenuitemstyle horizontalpadding="10"
          backcolor="LightBlue"/>
      
        <items>
          <asp:menuitem text="Home"
            tooltip="Home">
            <asp:menuitem text="Music"
              tooltip="Music">
              <asp:menuitem text="Classical"
                tooltip="Classical"/>
              <asp:menuitem text="Rock"
                tooltip="Rock"/>
              <asp:menuitem text="Jazz"
                tooltip="Jazz"/>
            </asp:menuitem>
            <asp:menuitem text="Movies"
              tooltip="Movies">
              <asp:menuitem text="Action"
                tooltip="Action"/>
              <asp:menuitem text="Drama"
                tooltip="Drama"/>
              <asp:menuitem text="Musical"
                tooltip="Musical"/>
            </asp:menuitem>
          </asp:menuitem>
        </items>
      
      </asp:menu>

    </form>
  </body>
</html>

<%@ Page Language="VB" %>

<!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 runat="server">
    <title>MenuItemStyle HorizontalPadding Example</title>
</head>
<body>
    <form id="form1" runat="server">
    
      <h3>MenuItemStyle HorizontalPadding Example</h3>
      
      <asp:menu id="NavigationMenu"
        staticdisplaylevels="2"
        staticsubmenuindent="10" 
        orientation="Vertical"
        runat="server">
        
        <staticmenuitemstyle horizontalpadding="10"
          backcolor="LightBlue"/>
        <dynamicmenuitemstyle horizontalpadding="10"
          backcolor="LightBlue"/>
      
        <items>
          <asp:menuitem text="Home"
            tooltip="Home">
            <asp:menuitem text="Music"
              tooltip="Music">
              <asp:menuitem text="Classical"
                tooltip="Classical"/>
              <asp:menuitem text="Rock"
                tooltip="Rock"/>
              <asp:menuitem text="Jazz"
                tooltip="Jazz"/>
            </asp:menuitem>
            <asp:menuitem text="Movies"
              tooltip="Movies">
              <asp:menuitem text="Action"
                tooltip="Action"/>
              <asp:menuitem text="Drama"
                tooltip="Drama"/>
              <asp:menuitem text="Musical"
                tooltip="Musical"/>
            </asp:menuitem>
          </asp:menuitem>
        </items>
      
      </asp:menu>

    </form>
  </body>
</html>

Opmerkingen

Gebruik de HorizontalPadding eigenschap om de hoeveelheid horizontale ruimte rond de tekst van het menu-item te bepalen waarop het MenuItemStyle object wordt toegepast. Deze ruimte wordt ingevoegd tussen de linkerrand van de tekst en de rand van het tekstgebied, en tussen de rechterrand van de tekst en de rand van de tekst. Gebruik de eigenschap om de VerticalPadding verticale afstand te bepalen.

Van toepassing op

Zie ook