-3
我正在一個項目中,我有一個計時器。當計時器結束時,我正在做一些說明,並將按鈕的可見性設置爲true。 此行的結果出現錯誤button.visible = true意外錯誤
"Invalid parameter" in Program.cs at line
Application.Run(new Main());
我不知道如何在一個按鈕的可見性的簡單變化可以在此處導致錯誤。
下面是代碼:
private void timerDuring_Tick(object sender, EventArgs e)
{
if (timeLeft > 0)
{
timeLeft = timeLeft - 1;
labelTime.Text = timeLeft +"";
}
else
{
TimerDuring.Stop();
labelTime.Visible = false;
VCapture.Dispose();
VCapture = null;
capture.Dispose();
CamImageBox.Visible = false;
String pathVideo = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "video.avi");
WMP.Visible = true;
WMP.URL = pathVideo; //Emplacement de la video apres la capture
WMP.uiMode = "none";
WMP.settings.setMode("loop", true);
WMP.Ctlcontrols.play(); // chaque image a recup
btnDecoupe.Visible = true; // ERROR caused HERE
btnReplay.Visible = true; // ERROR caused HERE
}
}
在哪裏,由Visual Studio所指示的錯誤的Program.cs:
static class Program
{
/// <summary>
/// Point d'entrée principal de l'application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Main());
}
}
當我改變Visibility
到false
它的工作原理,誤差僅爲拋出當我將其更改爲true時。
我的窗體的名稱是「Main.cs」在UI線程
你正在使用哪個計時器? –
c#Timer控件TimerDuring –
它是一個Windows.Forms.Timer,System.Threading.Timer或System.Timer –