由於某種原因導致ArgumentException「參數無效」。執行時在Application.Run獲取引發任一此:在將面板置於前面或更改可見性後,Application.Run出現ArgumentException
private void utilsTabBtn_Click(object sender, EventArgs e)
{
utilitiesPanel.BringToFront();
}
或該:
private void accountcreatorStartBtn_Click(object sender, EventArgs e)
{
accountcreatorStopBtn.Enabled = true;
accountcreatorStartBtn.Enabled = false;
recaptchaSolveBox.Enabled = true;
recaptchaContinueBtn.Enabled = true;
recaptchaRenewBtn.Enabled = true;
MinimalID = accIndexOne.Value;
CurrentID = MinimalID - 1;
MaximalID = accIndexTwo.Value;
RequestCaptcha();
recaptchaBox.SizeMode = PictureBoxSizeMode.StretchImage;
}
其中RequestCaptcha是:
private void RequestCaptcha()
{
LatestKey = ((new Random()).Next() * (new Random()).Next());
statusLbl.Text = "Captcha key: " + LatestKey.ToString();
recaptchaBox.Image.Dispose();
using (WebClient w = new WebClient())
{
w.DownloadFile(string.Format(RequestURL, LatestKey), Environment.CurrentDirectory + "/latestCaptcha.jpg");
}
try
{
recaptchaBox.Image = Image.FromFile(Environment.CurrentDirectory + "/latestCaptcha.jpg");
}
catch (Exception ex)
{
recaptchaBox.Image = recaptchaBox.ErrorImage;
MessageBox.Show(ex.Message, this.Text + " - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void utilsTabBtn_Click(object sender, EventArgs e)
{
utilitiesPanel.Visible = true;
accountcreatorPanel.Visible = false;
aboutPanel.Visible = false;
}
在這種代碼執行RequestCaptcha後
所有控件,除了以'TabBtn'結尾的按鈕和麪板外,都在我試圖隱藏的面板中。
你試過把一個斷點處最初的事件,然後進入它? – Logarr
我遍歷整個程序,只要utilsTabBtn_Click完成,就會拋出異常。 – 0x47686F7374
我不能從提供的示例中知道,但也許這個答案會有一些用處:[回覆](http://stackoverflow.com/a/389561/1127924) – Logarr