C sharp - error con el tamaño de letra en WPF

 
Vista:

error con el tamaño de letra en WPF

Publicado por Tolo (1 intervención) el 08/02/2021 18:40:20
Hola, tengo un form de display en el cual genero texto usando el siguiente código. En este caso he creado un simple

HOLA
ADIÓS

usando Arial 160, cual es mi sorpresa que la letra que me pinta en el form no hace 160px de alto, así como tampoco se alinea a la parte superior, no se si ese espacio de 'interlineado' puede ser el problema.

No se si alguien con mas experiencia puede ayudarme.

gracias

error-texto

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
TextBox textBox = new TextBox();
textBox.BorderThickness = new Thickness(1);
textBox.IsHitTestVisible = false;
textBox.Focusable = false;
textBox.TextWrapping = TextWrapping.WrapWithOverflow;
textBox.VerticalScrollBarVisibility = ScrollBarVisibility.Hidden;
textBox.HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden;
            textBox.Tag = (object)mText.Id;
textBox.Text = mText.Text;
textBox.FontSize = mText.Size;
textBox.Foreground = XDisplay.ConvertStringColorToBrush(mText.Color);
textBox.Background = XDisplay.ConvertStringColorToBrush(mText.BackgroundColor);
textBox.FontFamily = new FontFamily(mText.FontName);
textBox.FontWeight = mText.Bold ? FontWeights.Bold : FontWeights.Normal;
textBox.FontStyle = mText.Italic ? FontStyles.Italic : FontStyles.Normal;
textBox.Opacity = mText.Opacity;
textBox.Width = mText.Width;
textBox.Height = mText.Height;
textBox.TextAlignment = (TextAlignment)mText.Alignment;
 
Canvas.SetTop(textBox, mText.Y);
Canvas.SetLeft(textBox, mText.X);
Panel.SetZIndex(textBox, mText.Layer);
return textBox;
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder