Skip to content Skip to sidebar Skip to footer

Menampilkan isi Record pada DBGRID ke HINT di Delphi

Menampilkan isi Record pada DBGRID ke HINT di Delphi

بِسْــــــــــــــــمِ اﷲِالرَّحْمَنِ اارَّحِيم

Menampilkan isi Record pada DBGRID ke HINT. mungkin yang satu ini ssedikit bingung atau malah sudah ngerti. jadi intinya kita akan menampilkan data yang ada di DBGRID itu tampil pada HINT,tau kan hint itu apa. Lihat ini :

>Pertama tambahkan Coding dibawah (yang cetak tebal) ini di atas Variable  :
...................................
...................................
type
 THackGrid = class(TDBGrid); 
Var 
.................
>Kemudian Pada  event MouseMove diDBGRID :
procedure TForm1.DBGrid1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
var
  Cell: TGridCoord;
  ActRec: Integer;
begin
  Cell := DBGrid1.MouseCoord(X, Y);
  if dgIndicator in DBGrid1.Options then
    Dec(Cell.X);
  if dgTitles in DBGrid1.Options then
    Dec(Cell.Y);
  if THackGrid(DBGrid1).DataLink.Active and (Cell.X >= 0) and
    (Cell.Y >= 0) then
  begin
    ActRec := THackGrid(DBGrid1).DataLink.ActiveRecord;
    try
      THackGrid(DBGrid1).DataLink.ActiveRecord := Cell.Y;
      DBGrid.Hint := DBGrid1.Columns[Cell.X].Field.AsString; 
    finally
      THackGrid(DBGrid1).DataLink.ActiveRecord := ActRec;
    end;
  end;
end; 
untuk contoh source code yang sudah jadi :
Download
Jangan Lupa juga >>

Post a Comment for "Menampilkan isi Record pada DBGRID ke HINT di Delphi "