aspnet-devexpress-dot-web-dot-aspxcaptcha.md
Accesses the settings of the image displayed within the challenge image element.
Namespace : DevExpress.Web
Assembly : DevExpress.Web.v25.2.dll
NuGet Package : DevExpress.Web
public CaptchaImageProperties ChallengeImage { get; }
Public ReadOnly Property ChallengeImage As CaptchaImageProperties
| Type | Description |
|---|---|
| CaptchaImageProperties |
A CaptchaImageProperties object that contains image settings.
|
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