Ver Mensaje Individual
  #3  
Antiguo 26-10-2004
frudolph frudolph is offline
Miembro
 
Registrado: oct 2004
Posts: 40
Reputación: 0
frudolph Va por buen camino
En lugar de un componente checkbox prueba con esto:

Código:
procedure TForm1.StringGridMovimientosDrawCell(
	Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState);

const

AState: array[Boolean] of Cardinal = (0, DFCS_CHECKED);

begin

  with TStringGrid(Sender) do

	if (ARow > 0) and (ACol = 7) then
	  begin
		Canvas.FillRect(Rect);
		InflateRect(Rect, -2, -2);
		DrawFrameControl(Canvas.Handle, Rect, DFC_BUTTON, DFCS_BUTTONCHECK or AState[Cells[7, Arow] = 'F']);
	  end;
end;


Para que cuando el Usuario haga click en el checkbox y se tilde/destilde el mismo programa el Evento "OnMouseUp" del StringGrid con el siguiente código:

Código:
procedure TForm1.StringGridMovimientosMouseUp(
	Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
const
  AValue: array[Boolean] of String = ('', 'F');
var
  ACol, ARow: Integer;
begin
  with TStringGrid(Sender) do
	begin
	  MouseToCell(X, Y, ACol, ARow);
	  if (ARow > 0) and (ACol = 7) then
		Cells[ACol, ARow] := AValue[not (Cells[ACol, ARow] = 'F')];
	end;
end;

Responder Con Cita