aspnet-devexpress-dot-web-dot-captcha-dot-captchaimageproperties-b6894042.md
Gets or sets a font family used within the challenge image
Namespace : DevExpress.Web.Captcha
Assembly : DevExpress.Web.v25.2.dll
NuGet Package : DevExpress.Web
[DefaultValue("Times New Roman")]
public string FontFamily { get; set; }
<DefaultValue("Times New Roman")>
Public Property FontFamily As String
| Type | Default | Description |
|---|---|---|
| String | "Times New Roman" |
A string which specifies the font family of the challenge image.
|
The following part of the ASPxCaptcha - Features online demo illustrates how to customize the challenge image‘s style settings.
These settings are specified within a panel (ASPxComboBox, ASPxColorEdit editors) and applied to the captcha control via the Apply button (ASPxButton).
protected void btnApply_Click(object sender, EventArgs e) {
...
int parseResult = 0;
Captcha.ChallengeImage.FontFamily = cbFontFamily.Value.ToString();
Captcha.ChallengeImage.ForegroundColor = ceForegroundColor.Color;
Captcha.ChallengeImage.BackgroundColor = ceBackgroundColor.Color;
Captcha.ChallengeImage.BorderColor = ceBorderColor.Color;
if (int.TryParse(seBorderWidth.Text, out parseResult))
Captcha.ChallengeImage.BorderWidth = parseResult;
...
}
<dx:ASPxCaptcha ID="Captcha" runat="server" Width="402px">
<ValidationSettings ErrorDisplayMode="Text">
</ValidationSettings>
</dx:ASPxCaptcha>
...
<dx:ASPxComboBox ID="cbFontFamily" runat="server" Width="170px" ValueType="System.String">
<Items>
<dx:ListEditItem Text="Times New Roman" Value="Times New Roman" />
<dx:ListEditItem Text="Courier New" Value="Courier New" />
<dx:ListEditItem Text="Georgia" Value="Georgia" />
<dx:ListEditItem Text="Tahoma" Value="Tahoma" />
<dx:ListEditItem Text="Verdana" Value="Verdana" />
</Items>
</dx:ASPxComboBox>
...
<dx:ASPxColorEdit ID="ceForegroundColor" runat="server" Width="170px">
</dx:ASPxColorEdit>
...
<dx:ASPxColorEdit ID="ceBackgroundColor" runat="server" Width="170px">
</dx:ASPxColorEdit>
...
<dx:ASPxColorEdit ID="ceBorderColor" runat="server" Width="170px">
</dx:ASPxColorEdit>
...
<dx:ASPxSpinEdit ID="seBorderWidth" Width="50px" runat="server" MaxValue="10">
</dx:ASPxSpinEdit>
...
<dx:ASPxButton ID="btnApply" CssClass="DemoButton" runat="server" Text="Apply"
Width="70px" OnClick="btnApply_Click" />
See Also