Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#计时器传递变量_C#_Image_Variables_Timer - Fatal编程技术网

C#计时器传递变量

C#计时器传递变量,c#,image,variables,timer,C#,Image,Variables,Timer,我怎样才能把密码传给定时器?它说cor_xy_ficheiro在比赛中不存在 看来这对你有帮助。简言之: Emgu.CV.Image cvImg = new Emgu.CV.Image<Bgr, Byte>(cor_xy); Emgu.CV.Image cvImg=新Emgu.CV.Image(cor_xy); 在全局域中的方法之外声明它。通过这种方式,它可以通过按钮2\u单击和计时器_ficheiro\u勾选事件访问 Image<Bgr, byte> cor_xy_f

我怎样才能把密码传给定时器?它说cor_xy_ficheiro在比赛中不存在

看来这对你有帮助。简言之:

Emgu.CV.Image cvImg = new Emgu.CV.Image<Bgr, Byte>(cor_xy);
Emgu.CV.Image cvImg=新Emgu.CV.Image(cor_xy);

在全局域中的方法之外声明它。通过这种方式,它可以通过
按钮2\u单击
计时器_ficheiro\u勾选
事件访问

Image<Bgr, byte> cor_xy_ficheiro; //declare it outside

private void button2_Click(){ 
    //do something with cor_xy_ficheiro
}

private void timer_ficheiro_Tick(object sender, EventArgs e) { //name must match
    //do something with cor_xy_ficheiro
}

无论如何,另一个注意事项是:对于代码,你应该把它作为代码而不是图像放在你的问题中。

@user5672706:要使用
cor_xy_ficheiro
内部
timer_ficheiro_Tick
你应该将
cor_xy_ficheiro
移出
按钮2>范围。
Timer timer_ficheiro = new Timer();    
timer_ficheiro.Tick += timer_ficheiro_Tick; //event handler
timer_ficheiro.Interval = 1000; //interval in ms
timer_ficheiro.Enabled = true; //This you already put