小编use*_*r27的帖子

如何在WPF中创建计时器?

我是wpf中的计时器的新手,我需要一个代码,每5分钟就会弹出一个消息框..can任何人都可以帮我找到简单的计时器代码.

那是我到目前为止所尝试的:

System.Windows.Threading.DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer(); 
private void test() 
{ 
    dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick); 
    dispatcherTimer.Interval = new TimeSpan(0, 0, 1); 
    dispatcherTimer.Start(); 
} 
private void dispatcherTimer_Tick(object sender, EventArgs e)
{ 
    // code goes here 
} 

private void button1_Click(object sender, RoutedEventArgs e)
{ 
    test(); 
} 
Run Code Online (Sandbox Code Playgroud)

c# wpf

69
推荐指数
2
解决办法
14万
查看次数

如何绑定到WPF ProgressBar的Visibility元素?

如何绑定到WPF的ProgressBar可见性元素?我无法将它绑定到字符串属性,因为它需要一个包含三个选项的枚举:折叠,可见和隐藏.请显示ProgressBar的绑定可见性的可理解代码.提前致谢.

wpf

0
推荐指数
1
解决办法
3081
查看次数

标签 统计

wpf ×2

c# ×1