Mega Code Archive

 
Categories / Delphi / VCL
 

Show the text of a cell from a stringgrid as hint

Title: show the text of a cell from a stringgrid as hint? //im StringGrid den Zelleninhalt als Hint anzeigen //Variablen für letzte Zellen Position im Grid 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;