Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   MySQL (https://www.clubdelphi.com/foros/forumdisplay.php?f=21)
-   -   De DBGrid a QuantunGrid (https://www.clubdelphi.com/foros/showthread.php?t=74610)

RebeccaGL 28-06-2011 20:03:37

De DBGrid a QuantunGrid
 
Como podira pasar este codigo a una QuantumGrid.


Código Delphi [-]
 
procedure TForm_BeEMPPRJ.DBGrid_GANPERDrawColumnCell(Sender: TObject;
  const Rect: TRect; DataCol: Integer; Column: TColumn;
  State: TGridDrawState);
begin
  if (Column.Field = Query_GANPER.FieldByName('Concepto')) and
     (copy(Query_GANPER.FieldByName('FIND_Concepto').AsString,
      pos('_', Query_GANPER.FieldByName('FIND_Concepto').AsString) + 1, 2) = 'TI') or
     (Column.Field = Query_GANPER.FieldByName('Concepto')) and
     (copy(Query_GANPER.FieldByName('Concepto').AsString, 1, 1) = '*') then
  begin
    DBGrid_GANPER.Canvas.Font.Style := [fsBold];
    DBGrid_GANPER.Canvas.Font.Color := clBlack;
    if (gdSelected in State) and
       (DBGrid_GANPER.Focused) then
      DBGrid_GANPER.Canvas.Font.Color := clWhite;
  end;
  // Continue
  DBGrid_GANPER.DefaultDrawColumnCell(Rect, DataCol, Column, State);
end;

weke 08-07-2011 16:57:52

Hola connor,
a continuación te pongo una parte de código en la que compruebo el valor de uno de los campos en el grid para cambiarle el color. No es exactamente igual que tu caso, pero espero que te sirva por lo menos para ver más o menos como tratar los datos.

Código Delphi [-]
    
procedure TFSeleccion.GOrdenesDBTableView1CustomDrawCell(
  Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
  AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
begin
        if AViewInfo.GridRecord.Values[GOrdenesDBTableView1.GetColumnByFieldName('CAMPO').Index] = Valor then
            ACanvas.Brush.Color := clSkyBlue
        else
            ACanvas.Brush.Color := clPaleSel;

end;

Un saludo.


La franja horaria es GMT +2. Ahora son las 07:47:23.

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