Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Desarrollo en Delphi para Android
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy


Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 01-03-2016
jhonalone jhonalone is offline
Miembro
 
Registrado: sep 2007
Ubicación: Madrid
Posts: 547
Poder: 17
jhonalone Va por buen camino
Hola a todos.

Después de mucho probar y leer en la ayuda y ver las posibles funciones y procedimientos en muchos componentes de Delphi y, sobre todo, de dedicarle mucho tiempo esta semana, por fin he conseguido mi propósito.

Para ello, he utilizado el mismo evento que usaba en Windows, como decía Agustín, y como no podía ser de otro modo, es decir: el evento OnDraw del TStringGrid.

Por si le sirve a algún novato como yo, copio el código del evento a continuación, modificado desde el original de VCL (Windows), que ya he publicado más arriba, para FireMonkey. De forma que si alguien se encuentra con el mismo problema no tenga que perder tanto tiempo como yo.

Código Delphi [-]

procedure TPrinci.grdTableroDrawColumnCell(Sender: TObject;
  const Canvas: TCanvas; const Column: TColumn; const [Ref] Bounds: TRectF;
  const Row: Integer; const [Ref] Value: TValue; const State: TGridDrawStates);

  var Tablero : TTablero;
      R : TRectF;
      S : String;
begin    Cuantos:=Cuantos+1;
    R:=Bounds;
    StringGridToTablero(Tablero);
    ColTableroActual:=Column.Index;
    RowTableroActual:=Row;

  with grdTablero, grdTablero.Canvas do
  begin
        R.Width := Bounds.Width - 1;
        R.Height :=Bounds.Height-2;
        R.Left := R.Left + 2;
        R.Top := R.Top + 1;

    if  (ColAct = Column.Index) and (FilAct=Row) then
    begin
      ClearRect(R, claGreenyellow);
    end
    else begin
          if Odd((Column.Index div 3) + (Row div 3))
          then ClearRect(R, claLightgrey)
          else ClearRect(R, claLavender);
         end;

    if TableroGenerado[Column.Index, Row] > 0 then
      TextSettings.FontColor:=claRed
    else begin
         if (TableroAyudado[Column.Index, Row]=1) and
            (Tablero[Column.Index, Row]=TableroResuelto[Column.Index,Row]) //Es celda ayudada
         then TextSettings.FontColor:= claBlue
         else TextSettings.FontColor:= claBlack;
         end;
         Canvas.Fill.Color:=TextSettings.FontColor;
         Canvas.Font.SetSettings('Arial',22,grdTablero.TextSettings.Font.Style);
         S := grdTablero.Cells[Column.Index, Row];
         Canvas.FillText(R,S,False,1,[TFillTextFlag.ftRightToLeft],TTextAlign.taCenter, TTextAlign.taCenter);
  end;  // With
end;

Saludos a todos.
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
TStringGrid, colorear UNA celda. TiammatMX OOP 3 03-09-2012 23:01:49
¿Cómo colorear cada celda de un TStringGrid? Almd Internet 0 19-11-2008 12:38:47
Colorear Celdas De Un Objeto Tcalendar JUANRS Varios 0 29-08-2007 01:17:31
Colorear Celdas De Un Objeto Tcalendar JUANRS OOP 0 28-08-2007 01:28:28
colorear las celdas de un TstringGrid mangel OOP 2 16-12-2003 17:22:47


La franja horaria es GMT +2. Ahora son las 22:35:11.


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
Copyright 1996-2007 Club Delphi