MenuItemStyle.VerticalPadding Egenskap
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Hämtar eller anger mängden utrymme ovanför och under ett menyalternativs text.
public:
property System::Web::UI::WebControls::Unit VerticalPadding { System::Web::UI::WebControls::Unit get(); void set(System::Web::UI::WebControls::Unit value); };
public System.Web.UI.WebControls.Unit VerticalPadding { get; set; }
member this.VerticalPadding : System.Web.UI.WebControls.Unit with get, set
Public Property VerticalPadding As Unit
Egenskapsvärde
Mängden utrymme (i bildpunkter) ovanför och under ett menyalternativs text. Standardvärdet är 0.
Undantag
Exempel
Följande kodexempel visar hur du använder VerticalPadding egenskapen för att fylla det lodräta avståndet runt texten i ett menyalternativ med 10 bildpunkter.
<%@ 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 VerticalPadding Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>MenuItemStyle VerticalPadding Example</h3>
<asp:menu id="NavigationMenu"
staticdisplaylevels="2"
staticsubmenuindent="10"
orientation="Vertical"
runat="server">
<staticmenuitemstyle verticalpadding="10"
backcolor="LightBlue"/>
<dynamicmenuitemstyle verticalpadding="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 VerticalPadding Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>MenuItemStyle VerticalPadding Example</h3>
<asp:menu id="NavigationMenu"
staticdisplaylevels="2"
staticsubmenuindent="10"
orientation="Vertical"
runat="server">
<staticmenuitemstyle verticalpadding="10"
backcolor="LightBlue"/>
<dynamicmenuitemstyle verticalpadding="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>
Kommentarer
Använd egenskapen VerticalPadding för att styra mängden lodrätt utrymme runt texten i menyalternativet MenuItemStyle som objektet tillämpas på. Det här utrymmet infogas mellan textens övre kant och textområdets kantlinje, samt mellan den nedre kanten av texten och textens kantlinje. Använd egenskapen om HorizontalPadding du vill styra det vågräta avståndet.