//Para testar o exemplo abaixo inclua no seu form um componente StringGrid
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Grids;
type
TForm1 = class(TForm)
StringGrid1: TStringGrid;
procedure FormCreate(Sender: TObject);
procedure StringGrid1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
private
{ Private declarations }
public
{ Public declarations }
Col,Row : integer; // Declarar esta variável
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
// Evento OnCreate do Form
procedure TForm1.FormCreate(Sender: TObject);
begin
StringGrid1.Hint := '0 0';
StringGrid1.ShowHint := True;
end;
// Evento OnMouseMove do componente StringGrid
procedure TForm1.StringGrid1MouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
var r,c : integer;
begin
StringGrid1.MouseToCell(X, Y, C, R);
if ((Row <> r) or (Col <> c)) then
begin
Row := r; Col := c;
Application.CancelHint;
StringGrid1.Hint := 'Linha: '+IntToStr(r)+#32+'Coluna: '+IntToStr(c);
end;
end;
Mostrando postagens com marcador Mostrando um hint para cada coluna do stringgrid. Mostrar todas as postagens
Mostrando postagens com marcador Mostrando um hint para cada coluna do stringgrid. Mostrar todas as postagens
sábado, 5 de setembro de 2009
Assinar:
Postagens (Atom)

