DataGridViewCellToolTipTextNeededEventArgs.ToolTipText 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
도구 설명 텍스트를 가져오거나 설정합니다.
public:
property System::String ^ ToolTipText { System::String ^ get(); void set(System::String ^ value); };
public string ToolTipText { get; set; }
public string? ToolTipText { get; set; }
member this.ToolTipText : string with get, set
Public Property ToolTipText As String
속성 값
현재 도구 설명 텍스트입니다.
예제
다음은 커서가 ToolTipText 끝난 셀에 따라 속성을 설정하는 코드 예제입니다. 이 예제에서는 숨겨진 ToolTipText 열의 정보로 채워집니다 DataGridView.
void dataGridView1_CellToolTipTextNeeded(object sender,
DataGridViewCellToolTipTextNeededEventArgs e)
{
string newLine = Environment.NewLine;
if (e.RowIndex > -1)
{
DataGridViewRow dataGridViewRow1 = dataGridView1.Rows[e.RowIndex];
// Add the employee's ID to the ToolTipText.
e.ToolTipText = String.Format("EmployeeID {0}:{1}",
dataGridViewRow1.Cells["EmployeeID"].Value, newLine);
// Add the employee's name to the ToolTipText.
e.ToolTipText += String.Format("{0} {1} {2}{3}",
dataGridViewRow1.Cells["TitleOfCourtesy"].Value.ToString(),
dataGridViewRow1.Cells["FirstName"].Value.ToString(),
dataGridViewRow1.Cells["LastName"].Value.ToString(),
newLine);
// Add the employee's title to the ToolTipText.
e.ToolTipText += String.Format("{0}{1}{2}",
dataGridViewRow1.Cells["Title"].Value.ToString(),
newLine, newLine);
// Add the employee's contact information to the ToolTipText.
e.ToolTipText += String.Format("{0}{1}{2}, ",
dataGridViewRow1.Cells["Address"].Value.ToString(), newLine,
dataGridViewRow1.Cells["City"].Value.ToString());
if (!String.IsNullOrEmpty(
dataGridViewRow1.Cells["Region"].Value.ToString()))
{
e.ToolTipText += String.Format("{0}, ",
dataGridViewRow1.Cells["Region"].Value.ToString());
}
e.ToolTipText += String.Format("{0}, {1}{2}{3} EXT:{4}{5}{6}",
dataGridViewRow1.Cells["Country"].Value.ToString(),
dataGridViewRow1.Cells["PostalCode"].Value.ToString(),
newLine, dataGridViewRow1.Cells["HomePhone"].Value.ToString(),
dataGridViewRow1.Cells["Extension"].Value.ToString(),
newLine, newLine);
// Add employee information to the ToolTipText.
DateTime HireDate =
(DateTime)dataGridViewRow1.Cells["HireDate"].Value;
e.ToolTipText +=
String.Format("Employee since: {0}/{1}/{2}{3}Manager: {4}",
HireDate.Month.ToString(), HireDate.Day.ToString(),
HireDate.Year.ToString(), newLine,
dataGridViewRow1.Cells["Manager"].Value.ToString());
}
}
Public Sub dataGridView1_CellToolTipTextNeeded(ByVal sender As Object, _
ByVal e As DataGridViewCellToolTipTextNeededEventArgs) _
Handles dataGridView1.CellToolTipTextNeeded
Dim newLine As String = Environment.NewLine
If e.RowIndex > -1 Then
Dim dataGridViewRow1 As DataGridViewRow = _
dataGridView1.Rows(e.RowIndex)
' Add the employee's ID to the ToolTipText.
e.ToolTipText = String.Format("EmployeeID {0}: {1}", _
dataGridViewRow1.Cells("EmployeeID").Value.ToString(), _
newLine)
' Add the employee's name to the ToolTipText.
e.ToolTipText += String.Format("{0} {1} {2} {3}", _
dataGridViewRow1.Cells("TitleOfCourtesy").Value.ToString(), _
dataGridViewRow1.Cells("FirstName").Value.ToString(), _
dataGridViewRow1.Cells("LastName").Value.ToString(), _
newLine)
' Add the employee's title to the ToolTipText.
e.ToolTipText += String.Format("{0}{1}{2}", _
dataGridViewRow1.Cells("Title").Value.ToString(), _
newLine, newLine)
' Add the employee's contact information to the ToolTipText.
e.ToolTipText += String.Format("{0}{1}{2}, ", _
dataGridViewRow1.Cells("Address").Value.ToString(), newLine, _
dataGridViewRow1.Cells("City").Value.ToString())
If Not String.IsNullOrEmpty( _
dataGridViewRow1.Cells("Region").Value.ToString())
e.ToolTipText += String.Format("{0}, ", _
dataGridViewRow1.Cells("Region").Value.ToString())
End If
e.ToolTipText += String.Format("{0}, {1}{2}{3} EXT:{4}{5}{6}", _
dataGridViewRow1.Cells("Country").Value.ToString(), _
dataGridViewRow1.Cells("PostalCode").Value.ToString(), _
newLine, _
dataGridViewRow1.Cells("HomePhone").Value.ToString(), _
dataGridViewRow1.Cells("Extension").Value.ToString(), _
newLine, newLine)
' Add employee information to the ToolTipText.
Dim HireDate As DateTime = _
CType(dataGridViewRow1.Cells("HireDate").Value, DateTime)
e.ToolTipText += _
String.Format("Employee since: {0}/{1}/{2}{3}Manager: {4}", _
HireDate.Month.ToString(), HireDate.Day.ToString(), _
HireDate.Year.ToString(), newLine, _
dataGridViewRow1.Cells("Manager").Value.ToString())
End If
End Sub
설명
이 속성은 처음에 셀에 DataGridViewCell.ToolTipText 대해 설정된 경우 속성의 값을 포함합니다.