示例#1
0
 protected virtual void DesenharCabecalho(Gfx gfx)
 {
     if (!string.IsNullOrWhiteSpace(Cabecalho))
     {
         gfx.DrawString(Cabecalho.ToUpper(), RetanguloDesenhvael, Estilo.FonteCampoCabecalho, AlinhamentoHorizontal.Esquerda, AlinhamentoVertical.Topo);
     }
 }
示例#2
0
 protected virtual void DesenharCabecalho(Gfx gfx)
 {
     if (!string.IsNullOrWhiteSpace(Cabecalho))
     {
         gfx.DrawString(Cabecalho.ToUpper(), RetanguloDesenhvael, Estilo.FonteCampoCabecalho);
     }
 }
示例#3
0
        /// <summary>
        /// Imprime o cabeçalho do bloco.
        /// </summary>
        private void PrintCabecalho(PrimitiveComposer comp)
        {
            BlockComposer bComp = new BlockComposer(comp);

            RectangleF rect = new RectangleF(0, 0, Size.Width, Danfe.CabecalhoBlocoAltura);

            rect = rect.GetPaddedRectangleMm(0, 0, 1, 0.3F);

            comp.SetFont(Danfe.FontBold, 5);
            bComp.SafeBegin(rect, XAlignmentEnum.Left, YAlignmentEnum.Bottom);
            bComp.ShowText(Cabecalho.ToUpper());
            bComp.End();

            comp.Flush();
        }
示例#4
0
        /// <summary>
        /// Imprime o campo no composer.
        /// </summary>
        /// <param name="comp"></param>
        public void Print(PrimitiveComposer comp, org.pdfclown.documents.contents.fonts.Font fonte, org.pdfclown.documents.contents.fonts.Font fonteBold)
        {
            BlockComposer bComp = new BlockComposer(comp);
            RectangleF    pRect = Retangulo.GetPaddedRectangle(PaddingHorizontal, PaddingHorizontal, PaddingSuperior, PaddingInferior);

            comp.SetFont(fonteBold, TamanhoFonteCabecalho);
            ValidadeRectangle(pRect, comp);
            bComp.SafeBegin(pRect, XAlignmentEnum.Left, YAlignmentEnum.Top);
            bComp.ShowText(Cabecalho.ToUpper());
            bComp.End();

            bComp.LineSpace = new Length(LineSpace, Length.UnitModeEnum.Absolute);

            if (!String.IsNullOrWhiteSpace(Corpo))
            {
                org.pdfclown.documents.contents.fonts.Font fonteCorpo = IsCorpoNegrito ? fonteBold : fonte;

                double largura     = fonteCorpo.GetWidth(Corpo, CorpoTamanhoFonte);
                double novoTamanho = CorpoTamanhoFonte;

                if (!MultiLinha && largura > pRect.Width)
                {
                    novoTamanho = (CorpoTamanhoFonte * pRect.Width) / largura - Utils.Mm2Pu(0.005F);
                    comp.SetFont(fonteCorpo, novoTamanho);
                }

                comp.SetFont(fonteCorpo, novoTamanho);

                if (CorpoAlinhamentoY == YAlignmentEnum.Top)
                {
                    float yOffSet = (float)fonteBold.GetLineHeight(TamanhoFonteCabecalho) + LineSpace;
                    pRect.Y      += yOffSet;
                    pRect.Height -= yOffSet;
                }

                ValidadeRectangle(pRect, comp);
                bComp.SafeBegin(pRect, CorpoAlinhamentoX, CorpoAlinhamentoY);
                bComp.ShowText(Corpo);
                bComp.End();
            }

            comp.SafeDrawRectangle(Retangulo);
        }