Main Site Documentation

TextBlock Font Size. Is this a bug or am I doing something wrong?


#1

so I have a pretty simple Textblock defined in a window with the following definition:

<TextBlock Name="txtTempActual" X="189" Y="15" Width="60" Height="32" Alpha="255" Text="00.00" TextAlign="Left" TextVerticalAlign="Top" Font="5" FontColor="00FF00" BackColor="000000" ShowBackColor="False"/>

During normal program execution I alter the font size and height properties depending on conditions. Whenever the font surpasses droid_reg14 it fails to render. Here’s the code I use:


_txtTempActual.Font = FontManager.GetFont(FontManager.FontType.droid_reg16);
Window.FillRect(_txtTempActual.Rect);
_txtTempActual.Invalidate();

I have tried adjusting the height property prior to invalidating with no results. The results are always a blank filled rect; no rendering.


#2

Bah… You know sometimes it’s a good thing to get away from your work and take a break to realize what you were doing wrong.

Basically the GLIDE library wraps, the width I was programatically setting the textblock control was not wide enough, thus it was being wrapped to a non existant line (I guess – or not being rendered at all)

by making the textblock area much much larger than I needed I see that it is rendering and was most likely wrapping itself out of the visible bounds of the control.