All controls in the jControls CF35 library add additional text features above and beyond what is provided by default with the .Net Compact Framework.
By default, fonts are always anti-aliased. However, for some fonts, when the font's size is below a certain threshold, the glyphs may be drawn without antialiasing.
To get around this limitation, set the FontSmooting.Enabled
property to true
.
This is a system setting that will affect all applications and all controls, and will persist even after an application has exited. Therefore, it may be necessary to set this property every time an application starts to ensure consistent behavior.
This feature only applies to the device at runtime; it will not affect the display of text in the Visual Studio designer.
The ForeColor
property is almost always used as the color for a control's text. Although one can enter an alpha component, partial transparency is not yet supported for drawing text. However, a ForeColor
value with an alpha component of 0 (i.e. 100% transparent) can be used to prevent text from being drawn.
The TextAlignment
property provides the ability to horizontally and vertically align a control's Text
to the bounds of the control.
The TextMargin
property provides the ability to put padding between the edge of the control and area were text is drawn. Top, right, bottom, and left margins can all be adjusted independently.
The TextOffset
property can be used to translate the position of the control's text in both the X and Y direction relative to where it is placed by the TextAlignment
property. This can be useful to manually correct the position of text if it is not quite right by default. It is also used by the jButton when pressed to create the appearance of movement.
All jControls' Text
property can accept multi-line text. This type of input can be used to force a new line at any position in the text string.
If a control's text expands beyond the width of the control, it can be wrapped automatically by setting the TextWrap
property to WordBreak
.
This property was introduced to allow entering ampersand (&) characters in controls that don't need the Windows Mnemonic feature. It serves the same purpose as the .Net Compact Framework's UseMnemonic property.
Custom fonts can be used by selecting them in the Visual Studio designer, and then deploying the font file with the project's executable.
1. Select the ellipses for the Font
property in the Visual Studio property grid.
2. The Font dialog window will open. Check the Show all fonts checkbox to list all fonts installed on your development PC, and select the font you wish to use.
3. After selecting the font in Visual Studio, the text will appear correctly in the Visual Studio designer, but won't appear correctly when executed on the Windows CE device because the font does not yet exist there. To have the font deployed to the device with the application, add the font file to the project.
4. Then, select the font and change it's Build Action property to Content and it Copy to Output Directory property to Copy if newer.
When a jControls CF35 application is executed it will load any fonts it finds in the same directory as the executable. Since the font file was deployed with the executable in steps 3 and 4, the text will display correctly on the Windows CE device.