PHead wrote:
Is there any way to stop the console from scrolling? What I mean isnt
to not scroll at all, its that I want to get rid of the buffer. When
a new line is created, I want row 0 to go away permanently, not just
be scrolled out of view. No scroll bars, etc. I know the C# console is
weak, but even via Win32 API?
That's a good question. Generally speaking, a console application has no
influence over how the command shell application behaves, which is what
you're attempting to do. One way to achieve what you want is to create a
two-dimensional array of characters representing the screen:
char screen = new char[Console.WindowHeight, Console.WindowWidth];
Now, do all your printing into a buffer using MemoryStream. When you're
ready, write the stored characters on the virtual screen yourself,
performing your own scrolling. Finally, use Console.SetCursorPosition()
along with normal writing functions to write out the contents of the screen
buffer onto the real console. If you do this each time you need to draw
something on the screen, it should never have a chance to scroll.
Unfortunately, this is probably more work than it's worth. I hope this
helps.
--
Derrick Coetzee, MCP, MSFT (Speech Server)
This posting is provided "AS IS" with no warranties, and confers no
rights. Use of included code samples are subject to the terms
specified at
http://www.microsoft.com/info/cpyright.htm