3
I made a code to label a jpg
, writing in the footer of the image the address of the customer’s website.
The Problem: Some photos the text is coming giant as if it was 72px font instead of 12px font
Note that both photos are vertical, but the same text "www.sigasoftware.com.br" is in different size.
When running the VS debug apparently all values are similar, not justifying this font size, I need some hint of how I can try to find the problem
Follow part of the code of my class manipula_foto.cs
private void EstampaTexto(int _largura, int phHeight, Graphics grPhoto)
{
Font crFont = null;
SizeF crSize = new SizeF();
crFont = new Font("verdana", 12, FontStyle.Bold);
crSize = grPhoto.MeasureString(_textoetiqueta, crFont);
//imagem a 5% da altura, debaixo para cima.
int yPixlesFromBottom = (int)(phHeight * .05);
// Agora que temos um tamanho de ponto usar a altura das cordas Copyrights
// para determinar a coordenada y para desenhar a série de fotografia
float yPosFromBottom = ((phHeight - 10) - (crSize.Height / 2));
//Determinar a coordenada x calculando o centro da largura da imagem
float xCenterOfImg = (_largura / 2);
//definindo posição central do texto
StringFormat StrFormat = new StringFormat();
StrFormat.Alignment = StringAlignment.Center;
// retangulo de fundo
Brush brush = new SolidBrush(Color.FromArgb(120, 255, 255, 255));
grPhoto.FillRectangle(brush, 0, yPosFromBottom, _largura, 20);
//Texto Frente
SolidBrush semiTransBrush = new SolidBrush(Color.FromArgb(153, 255, 255, 255));
grPhoto.DrawString(_textoetiqueta, //string of text
crFont, //font
semiTransBrush, //Brush
new PointF(xCenterOfImg, yPosFromBottom), //Position
StrFormat); //Text alignment
}
I think my font is in point (but new Font aparece family, float size, Fontstyle)
– Dorathoto
The example I used was http://msdn.microsoft.com/en-us/library/4kxs7tfz(v=vs.110). aspx
– Dorathoto
And it worked by making that example?
– Maniero
not yet...rs...
– Dorathoto
It’s just that now I can’t test
Drawing
, then I try.– Maniero