/// <summary> /// Creates the table that holds the items /// </summary> private void CreateTable() { BorderCharList list = new BorderCharList(this.BorderStyle); System.Console.ForegroundColor = this.BorderColor; System.Console.BackgroundColor = this.BackColor; System.Console.Write(list.UpperLeft); for (Int32 j = 0; j < this.Width; j++) { System.Console.Write(list.OuterHorizontal); } System.Console.Write(list.UpperRight + "\n"); if (ShowTitle) { System.Console.Write(list.OuterVertical); System.Console.BackgroundColor = this.TitleBackColor; System.Console.ForegroundColor = this.TitleForeColor; for (Int32 i = 0; i < this.Width; i++) { System.Console.Write(" "); } System.Console.CursorLeft = FindCenter(this.Title); System.Console.Write(this.Title); System.Console.CursorLeft = (this.Width + 1); System.Console.ForegroundColor = this.BorderColor; System.Console.BackgroundColor = this.BackColor; System.Console.Write(list.OuterVertical + "\n"); System.Console.Write(list.OuterBreakRight); for (Int32 j = 0; j < this.Width; j++) { System.Console.Write(list.InnerHorizontal); } System.Console.Write(list.OuterBreakLeft + "\n"); } for (Int32 i = 0; i < this.Items.Count; i++) { System.Console.Write(list.OuterVertical.ToString()); for (Int32 j = 0; j < this.Width; j++) { System.Console.Write(" "); } System.Console.Write(list.OuterVertical + "\n"); if ((i + 1) != this.Items.Count) { System.Console.Write(list.OuterBreakRight); for (Int32 j = 0; j < this.Width; j++) { System.Console.Write(list.InnerHorizontal); } System.Console.Write(list.OuterBreakLeft + "\n"); } } System.Console.Write(list.LowerLeft); for (Int32 j = 0; j < this.Width; j++) { System.Console.Write(list.OuterHorizontal); } System.Console.Write(list.LowerRight + "\n"); this._lastLine = System.Console.CursorTop; }
/// <summary> /// Builds the table to store all the items in /// </summary> private void BuildLayout() { this._top = System.Console.CursorTop; System.Console.BackgroundColor = this.BackColor; System.Console.ForegroundColor = this.BorderColor; BorderCharList list = new BorderCharList(this.BorderStyle); Int32 width = (this.GridWidth * this.ItemWidth) + (this.GridWidth - 1); if (this._itemMatrix.Length == 0) { return; } // LOOP THE ROWS IN THE ITEM MATRIX for (Int32 i = 0; i < this._itemMatrix.Length; i++) { // CHECK IF THIS IS THE FIRST ROW if (i == 0) { System.Console.Write(list.UpperLeft); // LOOP EACH ITEM IN THIS ROW for (Int32 k = 0; k < this._gridWidth; k++) { for (Int32 j = 0; j < ItemWidth; j++) { System.Console.Write(list.OuterHorizontal); } if ((k + 1) != this._gridWidth) { System.Console.Write(list.OuterBreakDown); } } System.Console.Write(list.UpperRight + "\n"); } // LOOP THE ITEMS IN THIS ROW for (Int32 j = 0; j < this.GridWidth; j++) { if (j == 0) { System.Console.Write(list.OuterVertical); } for (Int32 l = 0; l < this.ItemWidth; l++) { System.Console.Write(" "); } if ((j + 1) == this.GridWidth) { System.Console.Write(list.OuterVertical + "\n"); } else { System.Console.Write(list.InnerVertical); } } // CHECK IF THIS IS THE LAST ROW if ((i + 1) == this._itemMatrix.Length) { System.Console.Write(list.LowerLeft); // LOOP EACH ITEM IN THIS ROW for (Int32 k = 0; k < this._gridWidth; k++) { for (Int32 j = 0; j < ItemWidth; j++) { System.Console.Write(list.OuterHorizontal); } if ((k + 1) != this._gridWidth) { System.Console.Write(list.OuterBreakUp); } } System.Console.Write(list.LowerRight + "\n"); } else { System.Console.Write(list.OuterBreakRight); // LOOP EACH ITEM IN THIS ROW for (Int32 k = 0; k < this._gridWidth; k++) { for (Int32 j = 0; j < ItemWidth; j++) { System.Console.Write(list.InnerHorizontal); } if ((k + 1) != this._gridWidth) { System.Console.Write(list.CrossSection); } } System.Console.Write(list.OuterBreakLeft + "\n"); } } this._bottom = System.Console.CursorTop; }