procedure TForm1.StringGrid1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
Var
Valor :String;
LGcCoord: TGridCoord; begin
LGcCoord := TCustomGrid(StringGrid1).MouseCoord(x,y);
GiCol := LGcCoord.X; GiRow := LGcCoord.Y; if (GiRow = 0) And (Button = mbleft) And (GiCol <> -1) then
Begin
with stringgrid1 do
Begin
GCelda := CellRect(GiCol,0);
Valor := Cells[GiCol, 0];
Canvas.Font := Font;
Canvas.Brush.Color := clBtnFace;
Canvas.FillRect(GCelda);
Canvas.TextRect(GCelda, GCelda.Left + 2, GCelda.Top + 2, Valor);
DrawEdge(Canvas.Handle, GCelda, 10, 2 or 4 or 8);
DrawEdge(Canvas.Handle, GCelda, 2 or 4, 1);
End;
End;
End;
procedure TForm1.StringGrid1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
Var
Valor :String;
begin
if (GiRow = 0) And (Button = mbleft) And (GiCol <> -1) then
Begin
with stringgrid1 do
Begin
Valor := Cells[Gicol, 0];
Canvas.Font := Font;
Canvas.Brush.Color := clBtnFace;
Canvas.FillRect(GCelda);
Canvas.TextRect(GCelda, GCelda.Left + 2, GCelda.Top + 2, Valor);
DrawEdge(Canvas.Handle, GCelda, 4, 4 or 8);
DrawEdge(Canvas.Handle, GCelda, 4, 1 or 2);
GCelda := stringgrid1.CellRect(1, 1);
End;
End;
end;