ChallengeImageCustomRenderEventArgs.Code Property
In This Article
Gets the code generated within the challenge image of the ASPxCaptcha control.
Namespace: DevExpress.Web.Captcha
Assembly: DevExpress.Web.v24.2.dll
NuGet Package: DevExpress.Web
#Declaration
#Property Value
Type | Description |
---|---|
String | A string value that represents the code. |
#Example
The example below demonstrates how to handle the ChallengeImageCustomRender event to implement a custom challenge image.
<dx:ASPxCaptcha ID="ASPxCaptcha1" runat="server"
OnChallengeImageCustomRender="OnChallengeImageCustomRender" />
protected void OnChallengeImageCustomRender(object sender, ChallengeImageCustomRenderEventArgs e) {
using (Graphics graphics = Graphics.FromImage(e.Image)) {
System.Drawing.Image backgroundImage = System.Drawing.Image.FromFile(Server.MapPath("~/pp.jpg"));
graphics.DrawImage(backgroundImage, 0, 0, e.Image.Width, e.Image.Height);
Font font = new Font("Times New Roman", 40.0f, FontStyle.Bold, GraphicsUnit.Pixel);
graphics.DrawString(e.Code, font, Brushes.Red, new PointF(0.0f, 0.0f));
graphics.Flush();
}
}
See Also