控制台应用程序点击鼠标X Y坐标检测/比较 [英] Console App Mouse-Click X Y Coordinate Detection/Comparison

查看:121
本文介绍了控制台应用程序点击鼠标X Y坐标检测/比较的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个游戏,我在C#控制台应用程序才去到更好的方法工作,纯粹是实践。相对于使用的东西,如Windows窗体应用程序,这已经按钮功能的内置,我努力抓住光标位置(我知道该怎么做),并定义它比很多地区的一个控制台应用程序中的也许像素的位置,但我也不知道是否有某种建在比像素以外的空间单元(这最后一点是我摸不清的部分)。

I have a game that I am working on in a C# console application, purely as practice before going on to better methods. As opposed to using something such as a Windows Forms App, which has button functionality built in, I am endeavoring to grab the cursor position (which I know how to do) and compare it to a number of area's inside a console application as defined by perhaps pixel location, but I also do not know if there is some sort of built in unit of space other than pixels (this last bit is the part I am unable to figure).

PS我知道这是笼统的,没有已提供的代码,但我不觉得这是需要所有我要求是如何抓住XY控制台应用程序内部协调的简要说明,并在INT变量把它们粘

P.S. I know this is in general terms, with no code already provided, but I do not feel that it is needed as all I am asking for is a brief explanation of how to grab X Y coordinates inside a console application, and stick them in int variables.

在提前非常感谢! :D

Many Thanks in advance! :D

推荐答案

什么@Frank克鲁格说。你真的想这样做吗? Windows窗体的设计,使这个的的更容易。

What @Frank Krueger said. Do you really want to do this? Windows Forms is designed to make this much easier.

如果你这样做,你需要使用的PInvoke到低级别的Windows API。尝试为出发点 - 但要知道,这是明显比Windows窗体应用程序会更复杂。

If you do, you'll need to use PInvoke into the low level Windows API. Try this as a starting point - but be aware that this is considerably more complex than the Windows Forms application would be.

这篇关于控制台应用程序点击鼠标X Y坐标检测/比较的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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