====== Text Features ====== All controls in the jControls CF35 library add additional text features above and beyond what is provided by default with the .Net Compact Framework. ===== FontSmoothing ===== 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. {{:jcontrols_cf35:fontsmoothingfalse.png|}} To get around this limitation, set the ''FontSmooting.Enabled'' property to ''true''. {{:jcontrols_cf35:fontsmoothingtrue.png|}} 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. ===== ForeColor Property ===== 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. ===== TextAlignment Property ===== The ''TextAlignment'' property provides the ability to horizontally and vertically align a control's ''Text'' to the bounds of the control. {{.:textalignment.png?nolink}} ===== TextMargin Property ===== 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. | {{:jcontrols_cf35:textboxmargin0.png }} | {{:jcontrols_cf35:textboxmargin0properties.png }} | | {{:jcontrols_cf35:textboxmargin10.png }} | {{:jcontrols_cf35:textboxmargin10properties.png }} | ===== TextOffset Property ===== 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|jButton]] when pressed to create the appearance of movement. |{{ .:textoffset0.png?nolink |}}|{{ .:textoffset0properties.png?nolink |}}| |{{ .:textoffset10.png?nolink |}}|{{ .:textoffset10properties.png?nolink |}}| ===== TextWrap Property ===== 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. {{.:multilinetextinput.png?nolink}} If a control's text expands beyond the width of the control, it can be wrapped automatically by setting the ''TextWrap'' property to ''WordBreak''. |{{ .:textwrapnone.png?nolink |}}|{{ .:textwrapnoneproperties.png?nolink |}}| |{{ .:textwrapwordbreak.png?nolink |}}|{{ .:textwrapwordbreakproperties.png?nolink |}}| ===== UseMnemonic Property ===== 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 [[https://msdn.microsoft.com/en-us/library/system.windows.forms.label.usemnemonic%28v=vs.90%29.aspx|.Net Compact Framework's UseMnemonic property]]. ===== Custom Fonts ===== 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. {{ .:fontelliipses.png?nolink |}} **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. {{ .:showallfontswindow.png?nolink |}} **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. {{ .:addcustomfont.mp4?800x450 }} **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//. {{ .:fontcopyalways.png?nolink |}} 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. {{ .:customfontondevice.png?nolink |}}