Skip to content

Cursor position #1736

Answered by elgonzo
bitpantry asked this question in Q&A
Jan 17, 2025 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

The System.Console class has properties to query this and other information about the cursor: https://learn.microsoft.com/en-us/dotnet/api/system.console#properties (note that cursor position is relative to the console/screen buffer, which can and often is larger than the actual console window. There are also properties that tell which part of the screen buffer is displayed in the console window, so you can translate between screen buffer coordinates and console window coordinates if you need to.)

Keep in mind that the concept of top/left cursor coordinates is only relevant when outputting into some screen/console buffer, and becomes meaningless when console output is being redirected.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@bitpantry
Comment options

Answer selected by patriksvensson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants