Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   Cambiar color por defecto al seleccionar varias celdas de un TStringGrid (https://www.clubdelphi.com/foros/showthread.php?t=79730)

JAI_ME 05-08-2012 07:40:53

Cambiar color por defecto al seleccionar varias celdas de un TStringGrid
 
Buenas noches tengo un TStringGrid y en el evento OnDrawCell el siguiente codigo


Código Delphi [-]
with SG1.Canvas do begin

  sTexto := Sg1.Cells[ACol,ARow];

    if sTexto <> '' then 
           Brush.Color := $00E1E1FF
    else 
      Brush.Color := clWhite;

end;

pero cuando intento seleccionar varias celdas no me muestra el recuadro azul que indica que celdas estoy seleccionando, si bloqueo la linea
Brush.Color := clWhite; si funciona


como puedo hacer para cambiar el color azul cuando selecciono varias celdas ???

ecfisa 05-08-2012 18:58:19

Hola JAI_ME.

No logré entender que deseas lograr por el contenido del mensaje, pero según el título:
Cita:

Cambiar color por defecto al seleccionar varias celdas de un TStringGrid
Podrías hacer:
Código Delphi [-]
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
  Rect: TRect; State: TGridDrawState);
begin
  if gdSelected in State then
    with TStringGrid(Sender) do
    begin
      Canvas.Brush.Color := $00E1E1FF;
      Canvas.FillRect(Rect);
      Canvas.TextRect(Rect, Rect.Left + 2, Rect.Top + 2, Cells[aCol, aRow]);
    end;
end;

Saludos.


La franja horaria es GMT +2. Ahora son las 03:54:27.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi