ListViewItem.ToolTipText 속성

정의

마우스 포인터가 ListViewItem을 가리킬 때 표시되는 텍스트를 가져오거나 설정합니다.

public:
 property System::String ^ ToolTipText { System::String ^ get(); void set(System::String ^ value); };
public string ToolTipText { get; set; }
member this.ToolTipText : string with get, set
Public Property ToolTipText As String

속성 값

마우스 포인터가 ListViewItem을 가리킬 때 표시되는 텍스트입니다.

예제

다음 코드 예제를 사용 ListView.ShowItemToolTips 하는 방법을 보여 줍니다는 및 ToolTipText 속성입니다. 이 예제를 실행 하려면 호출을 Windows Form에 코드를 붙여넣은 InitializeItemsWithToolTips 폼의 생성자에서 또는 Load 이벤트 처리 메서드.


// Declare the ListView.
private ListView ListViewWithToolTips;
private void InitializeItemsWithToolTips()
{

    // Construct and set the View property of the ListView.
    ListViewWithToolTips = new ListView();
    ListViewWithToolTips.Width = 200;
    ListViewWithToolTips.View = View.List;

    // Show item tooltips.
    ListViewWithToolTips.ShowItemToolTips = true;
    
    // Create items with a tooltip.
    ListViewItem item1WithToolTip = new ListViewItem("Item with a tooltip");
    item1WithToolTip.ToolTipText = "This is the item tooltip.";
    ListViewItem item2WithToolTip = new ListViewItem("Second item with a tooltip");
    item2WithToolTip.ToolTipText = "A different tooltip for this item.";

    // Create an item without a tooltip.
    ListViewItem itemWithoutToolTip = new ListViewItem("Item without tooltip.");

    // Add the items to the ListView.
    ListViewWithToolTips.Items.AddRange(new ListViewItem[]{item1WithToolTip, 
        item2WithToolTip, itemWithoutToolTip} );

    // Add the ListView to the form.
    this.Controls.Add(ListViewWithToolTips);
    this.Controls.Add(button1);
}
' Declare the ListView.
Private ListViewWithToolTips As ListView

Private Sub InitializeItemsWithToolTips() 
    
    ' Construct and set the View property of the ListView.
    ListViewWithToolTips = New ListView()
    ListViewWithToolTips.Width = 200
    ListViewWithToolTips.View = View.List
    
    ' Show item tooltips.
    ListViewWithToolTips.ShowItemToolTips = True
    
    ' Create items with a tooltip.
    Dim item1WithToolTip As New ListViewItem("Item with a tooltip")
    item1WithToolTip.ToolTipText = "This is the item tooltip."
    Dim item2WithToolTip As New ListViewItem("Second item with a tooltip")
    item2WithToolTip.ToolTipText = "A different tooltip for this item."
    
    ' Create an item without a tooltip.
    Dim itemWithoutToolTip As New ListViewItem("Item without tooltip.")
    
    ' Add the items to the ListView.
    ListViewWithToolTips.Items.AddRange(New ListViewItem() _
        {item1WithToolTip, item2WithToolTip, itemWithoutToolTip})
    
    ' Add the ListView to the form.
    Me.Controls.Add(ListViewWithToolTips)
    Me.Controls.Add(button1)

End Sub

설명

및 이 포함된 ListView 에 모두 ListViewItem ToolTips가 설정된 경우 의 도구 설명 ListViewItem 만 표시됩니다.

적용 대상