Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   OOP (https://www.clubdelphi.com/foros/forumdisplay.php?f=5)
-   -   TbsSkinStringGrid (https://www.clubdelphi.com/foros/showthread.php?t=83369)

Alejandro73 10-06-2013 21:56:27

TbsSkinStringGrid
 
Estimados

Estoy trabajando con una Grilla (TbsSkinStringGrid), es similar a StringGrid, se dibuja correctamente con sus respectivos títulos en las columnas, pero al momento de realizar una selección de un rango de celdas el texto que tiene cada una no se visualiza (el color del fondo es blanco y el texto negro), pude observar que cambiando el color de fondo a rojo el texto seleccionado en el rango se visualiza blanco, pero necesito que al momento de la selección el fondo quede azul y el texto blanco.

Adjunto el código cuando dibuja la celda

procedure F_CPL.grillapDrawCell(Sender: TObject;
ACol, ARow: Integer; Rect: TRect; State: TGridDrawState);
var
Grid : TbsSkinStringGrid;
Texto : String;
begin

Grid := TbsSkinStringGrid(Sender);


IF (ARow < Grid.FixedRows) or (ACol < Grid.FixedCols) then
begin
Grid.Canvas.Brush.Color := clBtnFace;
Grid.Canvas.Font.Color := clBlack;
Grid.Canvas.Font.Style := [fsBold];
end
else
begin
Grid.Canvas.Brush.Color := clWhite;
Grid.Canvas.Font.Color := clBlack;
Grid.Canvas.Font.Style := [];
end;

Grid.Canvas.FillRect(Rect);
Texto:=Grid.Cells[ACol,ARow];
DrawText( Grid.Canvas.Handle,PChar(Texto),StrLen(PChar(Texto)),Rect,DT_WORDBREAK);
end;

Casimiro Notevi 10-06-2013 22:06:32

Por favor, no olvides poner títulos descriptivos a tus preguntas ;)

Y recuerda poner los tags al código fuente, ejemplo:



Gracias :)

ecfisa 10-06-2013 22:34:15

Hola Alejandro73.

Desconozco el componente que mencionas pero, por si te sirve de ayuda, con un TStringGrid sería:
Código Delphi [-]
// Evento OnDrawCell
procedure TForm1.StringGridDrawCell(Sender: TObject; ACol, ARow: Integer;
  Rect: TRect; State: TGridDrawState);
begin
  if gdSelected in State then
    with TStringGrid(Sender) do
    begin
      Canvas.Brush.Color := clBlue;  // color fondo
      Canvas.Font.Color  := clWhite; // color letra
      Canvas.FillRect(Rect);
      Canvas.TextRect(Rect, Rect.Left + 2, Rect.Top + 2, Cells[aCol, aRow]);
    end;
end;

Saludos. :)

Alejandro73 10-06-2013 22:50:24

Gracias ecfisa, funciono perfectamente...


La franja horaria es GMT +2. Ahora son las 05:30:04.

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