Ver Mensaje Individual
  #4  
Antiguo 06-07-2011
gsilvei gsilvei is offline
Miembro
 
Registrado: jul 2006
Posts: 44
Reputación: 0
gsilvei Va por buen camino
DBGrid con botón

Hola a todos,
tengo un pequeño problema,
tengo un DBGrid y en una de las columnas tengo un botón
el problemas es que si coloco la propiedad dgRowSelect := True,
el botón no funciona y como False si funciona.
Estoy criando el botón con el siguiente código en el evento OnDrawColumnCell del DBGrid:

Código Delphi [-]
procedure TFormPrincipal.Grid_propostaDrawColumnCell(Sender: TObject;
  const Rect: TRect; DataCol: Integer; Column: TColumn;
  State: TGridDrawState);
var 
  BUTTON: Integer; 
  R: TRect; 
  SCapt : string;

begin
if Column.FieldName = 'P_OBS_INATIVO' then
  begin 
    Grid_proposta.Canvas.FillRect(Rect);
    BUTTON := 0; 
    R:=Rect; 
    SCapt := 'Ren.';
    InflateRect(R,-2,0); 
    DrawFrameControl(Grid_proposta.Canvas.Handle,R,BUTTON, BUTTON or BUTTON); 
    with Grid_proposta.Canvas do
    begin 
      Brush.Style := bsClear; 
      Font.Color := clBtnText; 
      TextRect(Rect, (Rect.Left + Rect.Right - TextWidth(SCapt)) div 2, (Rect.Top + Rect.Bottom - TextHeight(SCapt)) div 2, SCapt); 
    end; 
  end;
end;

sera que hay alguna otra opción para cuando seleccionar un registro pinte toda la linea.
Gracias
Responder Con Cita