SubMenuStyle クラス
アセンブリ: System.Web (system.web.dll 内)


SubMenuStyle クラスを使用して、Menu コントロールのサブメニューのスタイルを表します。サブメニューは、静的メニューまたは動的メニューに表示されます。静的メニューは常に Menu コントロールに表示されるのに対し、動的メニューは動的サブメニューを含む親メニュー項目の上にユーザーがマウス ポインタを置いた場合にのみ表示されます。次の表に示すプロパティを使用して、サブメニューの各種スタイル (フォント サイズや色など) を制御できます。
DynamicMenuStyle | |
StaticMenuStyle |
SubMenuStyle クラスは、Style クラスのほとんどのメンバを継承します。メニュー項目のテキストの余白サイズを制御するプロパティを実装することによって、Style クラスを拡張しています。HorizontalPadding プロパティを使用して、メニュー項目のテキストの左右の余白を制御します。同様に、VerticalPadding プロパティを使用して、メニュー項目のテキストの上下の余白を制御します。

動的メニューのサブメニューに対してカスタム スタイルを指定する方法を次の例に示します。
<%@ Page Language="VB" %> <html> <body> <form runat="server"> <h3>Menu DynamicMenuStyle Example</h3> <asp:menu id="NavigationMenu" staticdisplaylevels="2" staticsubmenuindent="10" orientation="Vertical" target="_blank" runat="server"> <dynamicmenustyle backcolor="LightSkyBlue" forecolor="Black" borderstyle="Solid" borderwidth="1" bordercolor="Black" /> <items> <asp:menuitem navigateurl="Home.aspx" text="Home" tooltip="Home"> <asp:menuitem navigateurl="Music.aspx" text="Music" tooltip="Music"> <asp:menuitem navigateurl="Classical.aspx" text="Classical" tooltip="Classical"/> <asp:menuitem navigateurl="Rock.aspx" text="Rock" tooltip="Rock"/> <asp:menuitem navigateurl="Jazz.aspx" text="Jazz" tooltip="Jazz"/> </asp:menuitem> <asp:menuitem navigateurl="Movies.aspx" text="Movies" tooltip="Movies"> <asp:menuitem navigateurl="Action.aspx" text="Action" tooltip="Action"/> <asp:menuitem navigateurl="Drama.aspx" text="Drama" tooltip="Drama"/> <asp:menuitem navigateurl="Musical.aspx" text="Musical" tooltip="Musical"/> </asp:menuitem> </asp:menuitem> </items> </asp:menu> </form> </body> </html>
<%@ Page Language="C#" %> <html> <body> <form runat="server"> <h3>Menu DynamicMenuStyle Example</h3> <asp:menu id="NavigationMenu" staticdisplaylevels="2" staticsubmenuindent="10" orientation="Vertical" target="_blank" runat="server"> <dynamicmenustyle backcolor="LightSkyBlue" forecolor="Black" borderstyle="Solid" borderwidth="1" bordercolor="Black" /> <items> <asp:menuitem navigateurl="Home.aspx" text="Home" tooltip="Home"> <asp:menuitem navigateurl="Music.aspx" text="Music" tooltip="Music"> <asp:menuitem navigateurl="Classical.aspx" text="Classical" tooltip="Classical"/> <asp:menuitem navigateurl="Rock.aspx" text="Rock" tooltip="Rock"/> <asp:menuitem navigateurl="Jazz.aspx" text="Jazz" tooltip="Jazz"/> </asp:menuitem> <asp:menuitem navigateurl="Movies.aspx" text="Movies" tooltip="Movies"> <asp:menuitem navigateurl="Action.aspx" text="Action" tooltip="Action"/> <asp:menuitem navigateurl="Drama.aspx" text="Drama" tooltip="Drama"/> <asp:menuitem navigateurl="Musical.aspx" text="Musical" tooltip="Musical"/> </asp:menuitem> </asp:menuitem> </items> </asp:menu> </form> </body> </html>

System.MarshalByRefObject
System.ComponentModel.Component
System.Web.UI.WebControls.Style
System.Web.UI.WebControls.SubMenuStyle


Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- SubMenuStyle クラスのページへのリンク