Mega Code Archive

 
Categories / Delphi / VCL
 

How to show the text of a cell from a stringgrid as hint

Title: How to show the text of a cell from a stringgrid as hint var LastRow, LastCol : Integer; //Cell Hint anzeigen procedure TForm1.ShowCellHint(X,Y:Integer); var ACol, ARow : Integer; begin //ShowHint auf True setzen If StringGrid.ShowHint = False Then StringGrid.ShowHint := True; //Col und Row Position lesen StringGrid.MouseToCell(X, Y, ACol, ARow); //wenn im g¨¹ltigen Bereich zeige Zelleninhalt als Hint If (ACol -1) And (ARow -1) Then StringGrid.Hint:=StringGrid.Cells[ACol,ARow]; If (AColLastCol) or (ARowLastRow) Then begin Application.CancelHint; LastCol:=ACol; LastRow:=ARow; end; end; //Example, im MouseMove Ereignis aufrufen procedure TForm1.StringGridMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); begin ShowCellHint(X,Y); end;