This question already has answers here:
Advanced Console IO in .NET
(4 answers)
Closed 4 years ago.
I am trying to create points inside a console window based on a 80x49 grid. But I am getting stuck on the basic idea.
My thought was to first of all print out spaces on the entire page so that later, when my method Draw() is called, it replaces a space with a character of choosing.
Keep in mind that the application should be able to print out new points on the same "canvas" again and again. Say that we first print a * at 4,5 and then a * at 4,7 . I am guessing SetCursorPos wouldn't work?
Yes, Console.SetCursorPosition is what you should use.
see advanced console io in .net
Related
This question already has answers here:
Writing string at the same position using Console.Write in C# 2.0
(2 answers)
Closed 1 year ago.
I've been trying to work on a program that renders text into a certain area on the command line. I have no idea how to do this. Basically, the user is going to choose a width and a height. I was wanting to use that data to put the text in a certain area of the screen. If you know how to do this please tell me.
You can pick where the next Console.Write command writes to, by setting the cursor position via the Console.SetCursorPosition method.
This question already has an answer here:
How to clear the entire console window?
(1 answer)
Closed 1 year ago.
I'm creating one of my first projects in visual studio code, and my game has a lot of text in it. I wanna know how to clear the terminal when the player goes into the next "level", so they don't see all the text fill up the screen from before.[What I want to clear while running the program] 1
You can use Console.Clear() method
You can use Console.SetCursorPosition(Int32, Int32) to set Cursor to 0,0 and redraw it without screen blink.
If you want simple clear Console.Clear() does the job, but it will take time to redraw Console again.
This question already has answers here:
C# allow simultaneous console input and output
(4 answers)
Closed 5 years ago.
I have a console app that is running multiple worker threads. I would like the console output to have one WriteLine to report the status of each thread. I know I can simply clear, and loop through my threads to report their status on some interval, but at the same time I want to type commands that would be processed by the application using ReadLine(). Is there a common approach to maintain the top x lines of a console to show scrolling or updated info, and have a line below them where I can type in commands and show results of those commands?
That's generally not how consoles work. You could however choose some sort of workarounds as suggested in the answers to this duplicate question: Multithreading: simultaneous console in- and output.
It is suggested there to override contents of the window and/or maintain the input by taking it character by character and redisplaying it.
You could also consider writing a simple non-console application (WinForms, WPF, UWP, etc.) to display a console-like output and input box.
Cheers
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Is there a way to overlay an application over a full-screened program?
Is it possible in C# to inject a text to process (like fraps for example), but without using any .dll injections?
Thanks in advance for responses.
#update
"A text" means some fast refreshing labels or something, which will show informations e.g.:
Name:Test
Pos: x=123,y=456,z=0
Level: Unknown
Something.....
You can use automation to send keyboard actions and suchlike to another program. Otherwise if there is no exposed API then things look bleak. See this question for an overview on the methods you use to send keystrokes.
EDIT: What you're asking for is not injection, it's an overlay. What you're looking to do is take control of the display buffer so that your overlay always has a higher z-index than whatever is being rendered. Take a look at this answer
This question already has an answer here:
Closed 10 years ago.
Possible Duplicate:
WP7 RTM Emulator is displaying the framecounter and dx info on the rightside - is this the default?
I want to take a nice screenshot of my app and send to a friend, but I got the silly debug string in the upper right corner. How to I remove it?
Seems to be numbers and shift if using acceleration for instance
Try running it as non-debug as you can:
Use a release build instead of a debug build
Use Ctrl-F5 instead of F5 to launch (so there's no debugger attached)
IIRC, that will prevent the diagnostic information from showing. It's probably that you only need to take one of these steps, but I couldn't tell you which offhand.