如何在控制台应用程序中获取光标的位置?

如何在控制台应用程序中获取光标的位置?

问题描述:

我希望能够检查光标的位置是否没有移过某个点。我还没有找到任何可通过Google提供文本光标位置的东西。我不太确定其他地方。

I would like to be able to check that the position of the cursor hasn't moved past a certain point. I haven't been able to find anything that gives the position of the text cursor via google. I'm not really sure where else to look.

查看Console类的各种方法和属性。具体来说,使用Console.CursorLeft和Console.CursorTop,可以获得并设置光标的位置。

Look at the various methods and properties of the Console class. Specifically, using Console.CursorLeft and Console.CursorTop, you can get and set the position of the cursor.