How to clear the terminal inside your c# program? [duplicate] - c#

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.

Related

Positioning Text in C# Console [duplicate]

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.

How would I go about drawing a rectangular selection on-screen when the mouse is dragged and then getting a screenshot of the selected area? [duplicate]

This question already has answers here:
.NET Equivalent of Snipping Tool
(3 answers)
Closed 5 years ago.
I'm looking for a way to draw a rectangular selection-visualiser, basically similar to Gyazo.
If any of you are familiar with iOS jailbreaking and have used Snapper 2 before, I'm trying to do that but for Windows. For those of you who aren't, it allows you to select an area you want for a screenshot and then keeps it on top of everything else, allowing you to drag it around, save it etc. It's really useful for phone numbers, WiFi passwords among other things.
The only issue is that I don't know how I'd go about drawing a selection area and grabbing an image of it.
Any help would be appreciated.
Windows since 7 has the Snipping tool. It might be close enough to the droid you are looking for: https://support.microsoft.com/en-us/help/13776/windows-use-snipping-tool-to-capture-screenshots
If you mean .NET with C#, there is Graphics.CopyFromScreen. Note that it does not work from Windows services - a interactive session is required and Services are barred from those by default since Vista.
One issues is having this thing be drawn "on top". Generally the topmost game is one you and the user can only loose. Everything that is able to win it is either part of Windows itself. Or uses a "intercept GPU output, draw something on top" approach, wich is not trivial.

.NET | How to keep form on fullscreen game [duplicate]

This question already has answers here:
How to make a window always stay on top in .Net?
(14 answers)
Closed 8 years ago.
I googled some sites but can't find. I want to keep form on fullscreen game. I make gametool software and that feature is important. I need *VB.NET or C# example for this.
Thank you!
NOT: I saw that topic:How to make a window always stay on top in .Net?. Bu the answer not work on games.
You need to HOOK into the game so you can render with the game (this is a pretty huge topic), unless the game is windowed, in that case you can just force the form to be the top window (Like the link in one of your comments explains).
Beware that this is considered an hack by most anti-cheat software (as it should..).
Things such as Steam are whiteflagged.

How do I remove the debug string in the windows emulator? [duplicate]

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.

Write at specified location (Console) [duplicate]

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

Categories