PDA

Ver la Versión Completa : Cambiar color por defecto al seleccionar varias celdas de un TStringGrid


JAI_ME
05-08-2012, 07:40:53
Buenas noches tengo un TStringGrid y en el evento OnDrawCell el siguiente codigo


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:
Cambiar color por defecto al seleccionar varias celdas de un TStringGrid

Podrías hacer:

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.