33 lines
725 B
C#

using System;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
namespace LibationWinForms.Dialogs.Login
{
public partial class CaptchaDialog : Form
{
public string Answer { get; private set; }
private MemoryStream ms { get; }
private Image image { get; }
public CaptchaDialog(byte[] captchaImage)
{
InitializeComponent();
this.FormClosed += (_, __) => { ms?.Dispose(); image?.Dispose(); };
ms = new MemoryStream(captchaImage);
image = Image.FromStream(ms);
this.captchaPb.Image = image;
}
private void submitBtn_Click(object sender, EventArgs e)
{
Answer = this.answerTb.Text;
DialogResult = DialogResult.OK;
// Close() not needed for AcceptButton
}
}
}