实时数据值显示在C# [英] Real time data value display in C#

查看:510
本文介绍了实时数据值显示在C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

简单的C#问题:我试图设计一个简单的C#DLL,它使用
第三方库从数码相机流式传输图像。

Simple C# question: I was trying to design a simple C# DLL that uses a third party library to stream images from a digital camera.

真的初学者C#程序员在这里,所以忍受我通过这个问题:)

Really beginner C# programmer here, so bear with me through this question :)

我添加了一个计数器的代码,以便每当一个图像被检索
计数器递增

I added a counter to the code so that whenever an image was retrieved the counter incremented.

我建立了一个无意义和简单的GUI,启动和停止按钮
确保一切正常工作,因为我们有
一些过去相机会停止流式传输
的问题,所以我想监视这个计时器计数器,以确保
不断增加。

I built a pointless and simple GUI with a start and stop button to make sure that everything was working properly because we were having some problems in the past where the camera would stop streaming suddenly, so I wanted to monitor this timer counter to make sure that it is continuously incrementing.

有什么明智的方法来实时显示
定时器值?该值只是一个UInt32,并且是从DLL中调用的对象
的一部分。

What is the sensible way to do this to get a real time display of the timer value? The value is just a UInt32 and is part of the object instationed from the DLL.

我实际实现的是马虎:
我有一个按钮会弹出一个显示定时器
值的消息框,因此,为了检查一切是否仍然正常工作,我
将按下此按钮两次以确保该值增加

What I actually implemented was sloppy: I have a button that would pop up a message box displaying the timer value when pressed, so to check if everything was still working, I would press this button twice to make sure the value had incremented somewhat.

正确的方法是什么?数据绑定?在这个简单的情况下,你会做多少
?我只想要一个标签/文本框/任何
,将不断刷新我的计数器数据成员的价值。

What is the proper way to do this? Data binding? What would most of you do in this simple case? I just want a label / textbox / anything that will constantly refresh with the value of my counter data member.

谢谢!

推荐答案

最简单的(假设您不能只在新数据到达时更新)将会在表单中添加一个表单计时器,并在定时器tick事件。

The simplest (assuming you can't just update when new data arrives) would be to add a forms timer to your form, and update the UI in the timer "tick" event.

http://msdn.microsoft.com/en-us/library/system.windows.forms.timer.aspx

这篇关于实时数据值显示在C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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