console - How do I redraw something that moves off screen? c# -


so created 'rectangular graphic' holds alphabet. thought remain @ top of 'viewable console' (like. . . scroll down user put in more text, etc. guess term 'floating' header.?

here's code it, code 'alphabet'

private static void headerfile() {     console.clear();     firstcolumn = console.cursorleft;     firstrow = console.cursortop;      int header_height = 6;     int columnnumber = console.windowwidth - 1;     var xcoord = 0;     var ycoord = 0;      (int = 0; < columnnumber; i++)     {         headerwindow("-", i, 0);         headerwindow("-", i, header_height);     }      (int = 0; < header_height; i++)     {         headerwindow("|", 0, i);         headerwindow("|", columnnumber, i);      }     headerwindow("+", xcoord = 0, ycoord = 0);     headerwindow("+", xcoord = columnnumber, ycoord = 0);     headerwindow("+", xcoord = 0, ycoord = 6);     headerwindow("+", xcoord = columnnumber, ycoord = 6); }  private static void letterchoices() {     string[] alphabetselection = file.readalllines("alphabet.txt");      (int = 0; < alphabetselection.length; i++)     {         //headerwindow("|", 0, 3);          headerwindow(alphabetselection[i], i*3+1, 1);         //console.write("\n ");         console.setcursorposition(0, 7);      }     //return; } 

so possible have floating 'graphic' remains @ top of console window? or, possible automatically 're-draw' same thing when top of moves below viewable area?

and if have redraw rectangle, there way save screen's state, clear console, redraw progress if program starting fresh, have 'inputs' (such chosen letters, etc.) remain on screen.

this 'hangman', btw. also, please try not write code me - let me know if can done , things might need @ in order such thing. :)

ahhh. every single action, redraws each time. now, given it's small program, how long think take each new redraw?

run , hit enter couple times.

it demonstrates entire screen being re-drawn each time:

static void main(string[] args) {     while(true)     {         console.clear();         console.writeline("top");         (int x = 0; x < console.windowwidth; x++)         {             (int y = 1; y < console.windowheight - 1; y++)             {                 console.setcursorposition(x, y);                 console.write("x");             }         }         console.setcursorposition(0, console.windowheight - 1);         console.write("prompt: ");         console.readline();     } } 

it's not prettiest, console app. expecting?... =)


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -