DataGridViewColumn.ToolTipText DataGridViewColumn.ToolTipText DataGridViewColumn.ToolTipText DataGridViewColumn.ToolTipText Property

定义

获取或设置用于工具提示的文本。Gets or sets the text used for ToolTips.

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

属性值

作为该列的工具提示所显示的文本。The text to display as a ToolTip for the column.

示例

下面的代码示例演示如何设置列的工具提示。The following code example shows how to set a column's ToolTip. 此代码示例是为DataGridViewColumn类提供的更大代码示例的一部分。This code example is part of a larger code example provided for the DataGridViewColumn class.

void ToolTips()
{
   DataGridViewColumn^ firstColumn = dataGridView->Columns[ 0 ];
   DataGridViewColumn^ thirdColumn = dataGridView->Columns[ 2 ];
   firstColumn->ToolTipText = L"This column uses a default cell.";
   thirdColumn->ToolTipText = L"This column uses a template cell."
   L" Style changes to one cell apply to all cells.";
}


private void ToolTips()
{
    DataGridViewColumn firstColumn = dataGridView.Columns[0];
    DataGridViewColumn thirdColumn = dataGridView.Columns[2];
    firstColumn.ToolTipText =
        "This column uses a default cell.";
    thirdColumn.ToolTipText =
        "This column uses a template cell." +
        " Style changes to one cell apply to all cells.";
}
Private Sub ToolTips()
    Dim firstColumn As DataGridViewColumn = _
        dataGridView.Columns(0)
    Dim thirdColumn As DataGridViewColumn = _
        dataGridView.Columns(2)
    firstColumn.ToolTipText = _
        "This is column uses a default cell."
    thirdColumn.ToolTipText = _
        "This is column uses a template cell." _
        & " Changes to one cell's style changes them all."
End Sub

注解

当鼠标指针停留在列标题上时,将显示该列的工具提示。The column's ToolTip displays when the mouse pointer rests on the column header.

适用于

另请参阅