使用vb.net的GUI ...与微控制器的串行通信 [英] GUI using vb.net...serial communication with microcontroller

查看:68
本文介绍了使用vb.net的GUI ...与微控制器的串行通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想在vb.net中创建GUI屏幕,然后找出GUI屏幕上任何点的坐标.

Hi,

I want to make GUI screen in vb.net and then find out the co-ordinates of any point on the GUI screen.

Can any one please help me?

推荐答案

一种可以使用Mouse.Move Event的方法,您可以在属于您主窗体的事件中找到它,
看起来像这样:

A way can be using Mouse.Move Event, you can find it in the events belongings to your main form,
it appears like this :

Private Sub Form1_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
    e.X = the x coordinate of mouse
    e.Y = the y coordinate of mouse
End Sub



对于串行通讯,请看以下内容:

使用Fluke和PC进行RS 232串行编程. /a> [ ^ ]



for serial comm , take a look a this :

RS 232 serial programming using fluke and PC.[^]


查看 ^ ]类-它将处理通信,尽管您将必须确定uProcessor如何获取数据并对其进行适当的格式化.

要获取GUI位置,请尝试处理 MouseMove [
Look at athe SerialPort[^] class - it will handle the communications, though you will have to work out how the uProcessor wants the data and format it appropriately.

To get the GUI position, try handling the MouseMove[^] event- the MouseEventArgs parameter will give you the mouse location.

However, I can''t remember if MouseMove fires for a form when the mouse is over a control - it may fire at teh control instead. If so, then you will have to handle the control MouseMove event as well and may have to translate the coordinates from local to form based. Not difficult, but it may be necessary.


除了其他答案都是100%正确(IMHO),我还要补充一点,如果您将自己设为触摸屏,那么这两个答案都将指向您向正确的方向.

但是另一方面,如果您尝试使用购买的触摸屏,则通常这些元素随驱动程序一起提供,然后触摸屏幕会生成正常的鼠标单击消息.那么您的工作将变得更加轻松,因此您无需考虑硬件部分,然后您的应用程序就可以与触摸屏和鼠标(谁知道您是否需要这一天)完美配合使用. >
HTH! :jig:
Apart that the other answers are 100% correct (IMHO) I would add that if you are making yourself the touch interface then both answers are pointing you to the right direction.

But in the other hand, if you are trying to use a bought touch screen, usually those elements come with a driver and then the touch of the screen generates a normal mouse click message. then your job would be really easier so you would not have to think in the hardware part and then your app would work perfectly with a touch screen and with a mouse (who knows if you''ll need that some day).

HTH! :jig:


这篇关于使用vb.net的GUI ...与微控制器的串行通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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