How do I resize my form according to the size of the PictureBox component?
In this case, captcha images may have different sizes. So I'd like my Form to fit the size of the PictureBox. For example, if the image increases in size, the Form should match its size.
Here I change the size of the PictureBox, but the Form does not resize.
public ResolverCaptcha(Bitmap imagemCaptcha, string mensagem)
{
InitializeComponent();
lblMensagem.Text = mensagem;
pctCaptcha.Width = imagemCaptcha.Width;
pctCaptcha.Height = imagemCaptcha.Height;
pctCaptcha.Image = imagemCaptcha;
}
This is the Form: