title: How to base my Header on the Width of the Window W/O having to repeatedly write the same code
body: <p>I'm about to pull my hair out. I've been trying to get this to work, but all I can come up with is a console screen that looks like this at the top:</p>
  
  <pre><code>+-------------------------------------------------------------------------------------------+
                                                                                              +
                                                                                              +
                                                                                              +
                                                                                              +
                                                                                              +
  Are you ready to play Hangman? yes/no:
  </code></pre>
  
  <p>What I'm trying to do is have Pipes on the short sides of the rectangle at the top (6 rows in length) with '+' on each of the four corners, as well as "----" across the bottom (just as it is currently at the top). I've written this thing 40 different ways but I seem to keep getting the same result. And it seems like it should be easier than writing each stinking line. </p>
  
  <p>So here's my code (I have hidden the unnecessary portions of the code):</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.IO;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  
  namespace Hangman
  {
  class Program
  {
  
      protected static int firstColumn;
      protected static int firstRow;
  
  
       protected static void headerWindow( string border, int posX, int posY)
      {
          try
          {
              Console.SetCursorPosition(firstColumn + posX, firstRow + posY);
              Console.Write(border);
  
          }
           catch(ArgumentOutOfRangeException error)
          {
              Console.Clear();
              Console.Write(error.Message);
  
          }
  
      }
  
      //I created a method to perform this, so that I can have the program stay open for either 1) a new game or 2) just to see if I could do it. It works!
      private static void printWord()
      {
          String[] myWordArrays = File.ReadAllLines("WordList.txt");
          Random randomWord = new Random();
          //int lineCount = File.ReadLines("WordList.txt").Count();            
          int activeWord = randomWord.Next(0, myWordArrays.Length);
          string userSelection = "";
  
          Console.WriteLine("Are you Ready to play Hangman? yes/no: ");
  
          userSelection = Console.ReadLine();
              if(userSelection == "yes")
              {
                  //This runs through the randomly chosen word and prints an underscore in place of each letter - it does work
                  foreach(char letter in myWordArrays[activeWord])
                  {
                      Console.Write("_ ");
  
                  }
  
                  //This prints to the console "Can you guess what this 'varyingLength' letter word is?" - it does work.
                  Console.WriteLine("\n \nCan you guess what this "+ myWordArrays[activeWord].Length +" letter word is?");
                  Console.ReadLine();
              } 
              else if(userSelection=="no")
              {
                  Console.WriteLine("I'm sorry you feel that way. Press Enter to Exit the program!");
                  Console.ReadLine();
              }
  
      }
  
      private static void headerFile()
      {
          Console.Clear();
          firstColumn = Console.CursorLeft;
          firstRow = Console.CursorTop;
  
          int columnNumber = Console.WindowWidth - 1;
          var xcoord = 0;
          var ycoord = 0;
  
          if(xcoord==0 &amp;&amp; ycoord==0)
          {
              headerWindow("+",xcoord,ycoord);
              Console.Write("");
              xcoord++;
          }
       }
  
  
  
      static void Main(string[] args)
      {
          headerFile();
          printWord();
      }
  }
  </code></pre>
  
  <p>}     </p>
  
  <p>I need to point out that if you see multiples of the same thing, it's because I have commented and hid the long lines of code (in case I want to use it later). It was supposed to stay hidden, but apparently Ctrl+A,C copies even the collapsed text in the IDE. </p>