WebControl.ToolTip Özellik

Tanım

Fare işaretçisi Web sunucusu denetiminin üzerine geldiğinde görüntülenen metni alır veya ayarlar.

public:
 virtual property System::String ^ ToolTip { System::String ^ get(); void set(System::String ^ value); };
[System.ComponentModel.Bindable(true)]
public virtual string ToolTip { get; set; }
public virtual string ToolTip { get; set; }
[<System.ComponentModel.Bindable(true)>]
member this.ToolTip : string with get, set
member this.ToolTip : string with get, set
Public Overridable Property ToolTip As String

Özellik Değeri

Fare işaretçisi Web sunucusu denetiminin üzerine geldiğinde görüntülenen metin. Varsayılan değer: Empty.

Öznitelikler

Örnekler

Aşağıdaki örnekte, temel sınıftan devralınan ToolTip denetimde Button özelliğinin nasıl ayarlanacağı WebControl gösterilmektedir.

Not

Aşağıdaki kod örneği tek dosyalı kod modelini kullanır ve doğrudan arka planda kod dosyasına kopyalandığında düzgün çalışmayabilir. Bu kod örneği.aspx uzantısına sahip boş bir metin dosyasına kopyalanmalıdır. Web Forms kod modeli hakkında daha fazla bilgi için bkz. ASP.NET Web Forms Sayfa Kodu Modeli.

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
 
    void SubmitBtn_Click(object sender, EventArgs e)
    {
        if (((Button)sender).CommandArgument == "1")
            Label1.Text = "Share your happiness!";
        else
            Label1.Text = "Be happy!";

        Label1.BorderColor = System.Drawing.Color.BurlyWood;
        Label1.BorderWidth = 4;
    }
 
 </script>
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head runat="server">
    <title>WebControl.ToolTip Example</title>
 </head>
 <body>
 <form id="Form1" runat="server">
 
    <h3>ToolTip Property of a Web Control</h3>
    <p>Don't know which button to click?<br />
        Move the mouse pointer over the buttons to find out!
    </p>

    <p><asp:Button id="SubmitBtn1" OnClick="SubmitBtn_Click" 
            Text="Click Me" CommandArgument="1"
            ToolTip="Click me if you are happy" runat="server"/>
    </p>

    <p><asp:Button id="SubmitBtn2" OnClick="SubmitBtn_Click" 
            Text="Click Me" CommandArgument="2"
            ToolTip="Click me if you are sad." runat="server"/>
    </p>

    <asp:Label id="Label1" Font-size="24pt" Font-Bold="True" 
        BackColor="Yellow" runat="server"/>

 </form>
 
 </body>
 </html>
<%@ Page Language="VB" AutoEventWireup="True" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <script language="VB" runat="server">
 
    Sub SubmitBtn_Click(ByVal sender As Object, ByVal e As EventArgs)
        If CType(sender, Button).CommandArgument = "1" Then
            Label1.Text = "Share your happiness!"
        Else
            Label1.Text = "Be happy!"
        End If
        Label1.BorderColor = Drawing.Color.BurlyWood
        Label1.BorderWidth = 4
    End Sub
 
 </script>
 
<html xmlns="http://www.w3.org/1999/xhtml" >
 <head runat="server">
    <title>ToolTip Property of a Web Control</title>
</head>
<body>
  
 <form id="form1" runat="server">
 
    <h3>ToolTip Property of a Web Control</h3>
    <p>Don't know which button to click?<br />
        Move the mouse pointer over the buttons to find out!
    </p>

    <p><asp:Button id="SubmitBtn1" OnClick="SubmitBtn_Click" 
            Text="Click Me" CommandArgument="1"
            ToolTip="Click me if you are happy" runat="server"/>
    </p>

    <p><asp:Button id="SubmitBtn2" OnClick="SubmitBtn_Click" 
            Text="Click Me" CommandArgument="2"
            ToolTip="Click me if you are sad." runat="server"/>
    </p>

    <asp:Label id="Label1" Font-size="24pt" Font-Bold="True" 
        BackColor="Yellow" runat="server"/>

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

Açıklamalar

ToolTip Fare işaretçisi Web sunucusu denetiminin üzerine geldiğinde görüntülenen özel metni belirtmek için özelliğini kullanın.

Not

Bu özellik tüm tarayıcılar için işlenir. Ancak, bu özelliği yalnızca Microsoft Internet Explorer Araç İpucu olarak görüntüler. Diğer tüm tarayıcılar bu özelliği yoksayar.

Bu özelliğin değeri ayarlandığında, tasarımcı aracı kullanılarak otomatik olarak bir kaynak dosyasına kaydedilebilir. Daha fazla bilgi için bkz LocalizableAttribute . ve Genelleştirme ve Yerelleştirme.

Şunlara uygulanır

Ayrıca bkz.