protected override void Draw(GraphicBuffer buffer) { base.Draw(buffer); buffer.DrawLine('#', new Coordinate(0, 2), new Coordinate(15, 2)); buffer.DrawLine('#', new Coordinate(0, 6), new Coordinate(0, 15)); buffer.DrawLine('#', new Coordinate(0, 19), new Coordinate(13, 36)); }
/// <summary> /// Draws a unfilled rectangle. /// </summary> /// <param name="buffer">The <see cref="GraphicBuffer"/> to draw on.</param> private void DrawUnfilledRectangle(GraphicBuffer buffer) { buffer.DrawLine(this.Token, this.Location, new Coordinate(this.Location.X + this.Size.Width - 1, this.Location.Y)); buffer.DrawLine(this.Token, new Coordinate(this.Location.X, this.Location.Y + this.Size.Height), new Coordinate(this.Location.X + this.Size.Width - 1, this.Location.Y)); buffer.DrawLine(this.Token, this.Location, new Coordinate(this.Location.X, this.Location.Y + this.Size.Height)); buffer.DrawLine(this.Token, new Coordinate(this.Location.X + this.Size.Width - 1, this.Location.Y), new Coordinate(this.Location.X + this.Size.Width - 1, this.Location.Y + this.Size.Height)); }
/// <summary> /// Draws the control. /// </summary> /// <param name="buffer">The <see cref="GraphicBuffer"/> to draw on.</param> protected override void Draw(GraphicBuffer buffer) { buffer.BackgroundDrawingColor = this.BackgroundColor; buffer.ForegroundDrawingColor = this.ForegroundColor; string background = String.Empty; background = background.PadRight(this.Size.Width, ' '); buffer.DrawLine(background, Coordinate.Origin); buffer.DrawLine(this.Text, Coordinate.Origin); }
/// <summary> /// Draws a filled rectangle. /// </summary> /// <param name="buffer">The <see cref="GraphicBuffer"/> to draw on.</param> private void DrawFilledRectangle(GraphicBuffer buffer) { for (int y = this.Location.Y - 1; y < this.Location.Y + this.Size.Height - 1; y++) { buffer.DrawLine(this.Token, this.Location + new Coordinate(0, y + 1), this.Location + new Coordinate(this.Size.Width - 1, 0)); } }
/// <summary> /// Draws the control. /// </summary> /// <param name="buffer">The <see cref="GraphicBuffer"/> to draw on.</param> protected override void Draw(GraphicBuffer buffer) { buffer.ForegroundDrawingColor = this.ForegroundColor; buffer.BackgroundDrawingColor = this.BackgroundColor; buffer.DrawRectangle(' ', Coordinate.Origin, this.Size, true); var words = new List <string>(); words.AddRange(this.Text.Split(' ')); //Split text into words var lines = new List <string>(); // If there is only one word, draw it immediately. // This fixes a bug, which caues a cut-off at the end of a line // (the cut-off for only one word is desired) if (words.Count == 1) { lines.Add(words[0]); } else { do { string line = String.Empty; bool first = true; for (int i = 0; i < words.Count; i++) { if (line.Length + words[0].Length < this.Size.Width) //check if the line fits into the label { string space = first ? String.Empty : " "; first = false; line += space + words[0]; words.Remove(words[0]); i--; } else { break; } } lines.Add(line); }while (words.Count > 0 && lines.Count < this.Size.Height); } for (int i = 0; i < lines.Count; i++) { buffer.DrawLine(lines[i], new Coordinate(0, i)); } }
/// <summary> /// Draws the control. /// </summary> /// <param name="buffer">The <see cref="GraphicBuffer"/> to draw on.</param> protected override void Draw(GraphicBuffer buffer) { buffer.ForegroundDrawingColor = this.ForegroundColor; buffer.BackgroundDrawingColor = this.BackgroundColor; buffer.DrawRectangle(' ', Coordinate.Origin, this.Size, true); for (int i = 0; i < this.items.Count && i < this.Size.Height; i++) { string bulletString = this.DisplayBullets ? this.Bullet + " " : String.Empty; buffer.DrawLine(bulletString + this.items[i], new Coordinate(0, i)); } }
/// <summary> /// Draws the control. /// </summary> /// <param name="buffer">The <see cref="GraphicBuffer"/> to draw on.</param> protected override void Draw(GraphicBuffer buffer) { for (int i = 0; i < this.Items.Count; i++) { buffer.ForegroundDrawingColor = this.ForegroundColor; buffer.BackgroundDrawingColor = this.BackgroundColor; if (this.SelectedIndex == i) { buffer.ForegroundDrawingColor = this.SelectionForegroundColor; buffer.BackgroundDrawingColor = this.SelectionBackgroundColor; } string bulletString = this.DisplayBullets ? this.Bullet + " " : String.Empty; buffer.DrawLine(bulletString + this.items[i].Name, new Coordinate(0, i)); buffer.ResetColor(); } }
/// <summary> /// Draws a filled rectangle. /// </summary> /// <param name="buffer">The <see cref="GraphicBuffer"/> to draw on.</param> private void DrawFilledRectangle(GraphicBuffer buffer) { for (int y = this.Location.Y - 1; y < this.Location.Y + this.Size.Height - 1; y++) { buffer.DrawLine(this.Token, this.Location + new Coordinate(0, y + 1), this.Location + new Coordinate(this.Size.Width - 1, 0)); } }
/// <summary> /// Draws a unfilled rectangle. /// </summary> /// <param name="buffer">The <see cref="GraphicBuffer"/> to draw on.</param> private void DrawUnfilledRectangle(GraphicBuffer buffer) { buffer.DrawLine(this.Token, this.Location, new Coordinate(this.Location.X + this.Size.Width - 1, this.Location.Y)); buffer.DrawLine(this.Token, new Coordinate(this.Location.X, this.Location.Y + this.Size.Height), new Coordinate(this.Location.X + this.Size.Width - 1, this.Location.Y)); buffer.DrawLine(this.Token, this.Location, new Coordinate(this.Location.X, this.Location.Y + this.Size.Height)); buffer.DrawLine(this.Token, new Coordinate(this.Location.X + this.Size.Width - 1, this.Location.Y), new Coordinate(this.Location.X + this.Size.Width - 1, this.Location.Y + this.Size.Height)); }