MenuItem.ToolTip Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the ToolTip text for the menu item.
public:
property System::String ^ ToolTip { System::String ^ get(); void set(System::String ^ value); };
public string ToolTip { get; set; }
member this.ToolTip : string with get, set
Public Property ToolTip As String
Property Value
The ToolTip text for the menu item. The default is an empty string ("").
Examples
The following example demonstrates how to use the ToolTip property to specify a ToolTip for each menu item in a Menu control.
<%@ 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>MenuItem Declarative Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>MenuItem Declarative Example</h3>
<!-- Use declarative syntax to create the -->
<!-- menu structure. Create submenu items -->
<!-- by nesting them within parent menu -->
<!-- items. -->
<asp:menu id="NavigationMenu"
staticdisplaylevels="1"
staticsubmenuindent="10"
orientation="Vertical"
target="_blank"
runat="server">
<items>
<asp:menuitem navigateurl="Home.aspx"
text="Home"
imageurl="Images\Home.gif"
popoutimageurl="Images\Popout.jpg"
tooltip="Home">
<asp:menuitem navigateurl="Music.aspx"
text="Music"
popoutimageurl="Images\Popout.jpg"
tooltip="Music">
<asp:menuitem navigateurl="Classical.aspx"
text="Classical"
separatorimageurl="Images\Separator.jpg"
tooltip="Classical"/>
<asp:menuitem navigateurl="Rock.aspx"
text="Rock"
separatorimageurl="Images\Separator.jpg"
tooltip="Rock"/>
<asp:menuitem navigateurl="Jazz.aspx"
text="Jazz"
separatorimageurl="Images\Separator.jpg"
tooltip="Jazz"/>
</asp:menuitem>
<asp:menuitem navigateurl="Movies.aspx"
text="Movies"
popoutimageurl="Images\Popout.jpg"
tooltip="Movies">
<asp:menuitem navigateurl="Action.aspx"
text="Action"
separatorimageurl="Images\Separator.jpg"
tooltip="Action"/>
<asp:menuitem navigateurl="Drama.aspx"
text="Drama"
separatorimageurl="Images\Separator.jpg"
tooltip="Drama"/>
<asp:menuitem navigateurl="Musical.aspx"
text="Musical"
separatorimageurl="Images\Separator.jpg"
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>MenuItem Declarative Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>MenuItem Declarative Example</h3>
<!-- Use declarative syntax to create the -->
<!-- menu structure. Create submenu items -->
<!-- by nesting them within parent menu -->
<!-- items. -->
<asp:menu id="NavigationMenu"
staticdisplaylevels="1"
staticsubmenuindent="10"
orientation="Vertical"
target="_blank"
runat="server">
<items>
<asp:menuitem navigateurl="Home.aspx"
text="Home"
imageurl="Images\Home.gif"
popoutimageurl="Images\Popout.jpg"
tooltip="Home">
<asp:menuitem navigateurl="Music.aspx"
text="Music"
popoutimageurl="Images\Popout.jpg"
tooltip="Music">
<asp:menuitem navigateurl="Classical.aspx"
text="Classical"
separatorimageurl="Images\Separator.jpg"
tooltip="Classical"/>
<asp:menuitem navigateurl="Rock.aspx"
text="Rock"
separatorimageurl="Images\Separator.jpg"
tooltip="Rock"/>
<asp:menuitem navigateurl="Jazz.aspx"
text="Jazz"
separatorimageurl="Images\Separator.jpg"
tooltip="Jazz"/>
</asp:menuitem>
<asp:menuitem navigateurl="Movies.aspx"
text="Movies"
popoutimageurl="Images\Popout.jpg"
tooltip="Movies">
<asp:menuitem navigateurl="Action.aspx"
text="Action"
separatorimageurl="Images\Separator.jpg"
tooltip="Action"/>
<asp:menuitem navigateurl="Drama.aspx"
text="Drama"
separatorimageurl="Images\Separator.jpg"
tooltip="Drama"/>
<asp:menuitem navigateurl="Musical.aspx"
text="Musical"
separatorimageurl="Images\Separator.jpg"
tooltip="Musical"/>
</asp:menuitem>
</asp:menuitem>
</items>
</asp:menu>
</form>
</body>
</html>
Remarks
Use the ToolTip property to specify the ToolTip text for the menu item. The ToolTip text is displayed when the mouse pointer is positioned over the menu item.
The value of this property, when set, can be saved automatically to a resource file by using a designer tool. For more information, see LocalizableAttribute and Globalization and Localization.
Applies to
See also
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈