PAGUE 6 MESES
LEVE 12 MESES
GARANTIR DESCONTO

Fórum procedure Tfrm.dbGridDrawColumnCell em loop Infinito? #574220

25/01/2017

0

Boa tarde!
eu estou implementando um Código no Delphi 10.1 Berlin que o evento DrawColumnCell está entrando em loop infinito eu testei no Delphi 7 e fica normal depois que eles roda todos os itens da grid ele para já no Delphi 10.1 Berlin ele não para.
se alguém souber dizer o que faz isso acontecer ficaria muito grato. Já tem uns dias tentando resolver isso e não consigo...
Código como está no evento abaixo

  if (dbgCentroCusto.Columns[datacol].Field.FieldName = 'CODIGO_CENTRO_CUSTO') then
  begin
    if (Copy(DataModuleGeral2.qryPesquisaCentroCustoCODIGO_CENTRO_CUSTO.AsString,4,8) = '00.00') then // 1º Nivel
    begin
      R := Rect;
      Format := FmtLeft;
      dbgCentroCusto.Canvas.FillRect(Rect);
      dbgCentroCusto.Canvas.Font.Style := [fsbold];
    end else
    if (dbgCentroCusto.Columns[datacol].Field.FieldName = 'CODIGO_CENTRO_CUSTO') and
       ((Copy(DataModuleGeral2.qryPesquisaCentroCustoCODIGO_CENTRO_CUSTO.AsString,4,8) <> '00') and
        (Copy(DataModuleGeral2.qryPesquisaCentroCustoCODIGO_CENTRO_CUSTO.AsString,7,8) =  '00'))then // 2º Nivel
    begin
      R := Rect;
      Format := FmtCentered;
      dbgCentroCusto.Canvas.FillRect(Rect);
      dbgCentroCusto.Canvas.Font.Style := [fsbold];
    end else
    if (dbgCentroCusto.Columns[datacol].Field.FieldName = 'CODIGO_CENTRO_CUSTO') then // 3º Nivel
    begin
      R := Rect;
      Format := FmtRight;
      dbgCentroCusto.Canvas.FillRect(Rect);
    end;
    // Aplica as mudanção no visual da Grid:         Conteudo do Celula          Tamanho do Conteudo do Celula           Alinhamento
    DrawText(dbgCentroCusto.Canvas.Handle, PChar(' '+Column.Field.AsString+' '), Length (' '+Column.Field.AsString+' '), R, Format);
  end;
Eduardo Silva

Eduardo Silva

Responder

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar