Exemplo n.º 1
0
        /// <summary>
        /// Form load event.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MainForm_Load(object sender, EventArgs e)
        {
            /*New instance was created from WinFormCaptcha and
             * was set necessary parameters.*/
            cp = new WinFormCaptcha(int.Parse(NumTextLength.Value.ToString()),
                                    PanelCaptcha.Width, PanelCaptcha.Height);

            //Captcha image was created and was set as background image of the panel's.
            PanelCaptcha.BackgroundImage = cp.DrawCaptcha();
            PictureBox v = new PictureBox();

            v.Image = cp.DrawCaptcha();
        }
Exemplo n.º 2
0
        /// <summary>
        /// This method is change captcha setting when changed captcha preferences.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RBtns_CheckedChanged(object sender, EventArgs e)
        {
            if (RBtnNormCaptcha.Checked)
            {
                cp = new WinFormCaptcha(int.Parse(NumTextLength.Value.ToString()),
                                        PanelCaptcha.Width, PanelCaptcha.Height, CBoxNumeric.Checked,
                                        CBoxLowCaseChar.Checked, CBoxUpCaseChar.Checked, CBoxSymbol.Checked,
                                        CBoxLine.Checked, CBoxNoise.Checked, CBoxMessy.Checked, CBoxDistImg.Checked);

                cp.ChangeNormCaptchaSettings(CBoxNumeric.Checked, CBoxLowCaseChar.Checked,
                                             CBoxUpCaseChar.Checked, CBoxSymbol.Checked, CBoxLine.Checked,
                                             CBoxNoise.Checked, CBoxMessy.Checked, CBoxDistImg.Checked);
            }
            else if (RBtnMathCaptcha.Checked)
            {
                cp.ChangeMathCaptchaSettings(CBoxAdd.Checked, CBoxSubt.Checked,
                                             CBoxMultp.Checked, CBoxDiv.Checked, CBoxLine.Checked,
                                             CBoxNoise.Checked, CBoxMessy.Checked, CBoxDistImg.Checked);

                cp = new WinFormCaptcha(PanelCaptcha.Width, PanelCaptcha.Height, CBoxAdd.Checked,
                                        CBoxSubt.Checked, CBoxMultp.Checked, CBoxDiv.Checked, CBoxLine.Checked,
                                        CBoxNoise.Checked, CBoxMessy.Checked, CBoxDistImg.Checked);
            }
        }