VS 2017工具箱缺少计时器 [英] VS 2017 toolbox is missing timer

查看:130
本文介绍了VS 2017工具箱缺少计时器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尽管我努力,但无法找到计时器控制。在"WPF组件"中没有可见的。或者。

Timer control is nowhere to be found despite my efforts. There is no visible in "WPF components" either.

帮助!

推荐答案

嗨吉米,

请参阅您的描述,我想您当前的项目类型是WPF。据我所知,没有这样的Timer控件,它应该是

DispatcherTimer
它不是一个控件但在代码中使用,它基本上像Windows窗体应用程序中的Timer控件一样工作,请看看

这个类似问题

Refer to your description, I suppose your current project type is WPF. As far as I know, there is no such Timer control and it should be DispatcherTimer which is not a control but used in code, it basically works like the Timer control in the Windows Forms application, please have a look at this similar issue.

使用
System Windows 线程 ;

      

       
DispatcherTimer dispatcherTimer =
new
系统 Windows 线程 。DispatcherTimer();

        DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer();

       
dispatcherTimer.Tick + =
new EventHandler(dispatcherTimer_Tick);

        dispatcherTimer.Tick +=new EventHandler(dispatcherTimer_Tick);

       
dispatcherTimer.Interval =
new TimeSpan(0,0,1);

        dispatcherTimer.Interval = new TimeSpan(0, 0, 1);

       
dispatcherTimer.Start();

        dispatcherTimer.Start();

       
私人
void dispatcherTimer_Tick( object
sender ,EventArgs
e

        private void dispatcherTimer_Tick(object sender, EventArgs e)

       
{

        {

< span style ="color:black; FONT-FAMILY:索拉; font-size:9.5pt">            
//代码

       
}

        }

< span style ="font-family:'Calibri',sans-serif;字体大小:11pt">希望上述信息对您的问题有所帮助,有关WPF开发的更多问题,请转到此WPF支持论坛:
https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=wpf 寻求更好的支持,谢谢你的理解。

Hope the above information is helpful for your issue, for more WPF development issues and please redirect to this WPF support forum: https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=wpf to seek for a better support, thank you for your understanding.

最好的问候,

Sara


这篇关于VS 2017工具箱缺少计时器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆