public WrappedLabel(int topRow, int leftColumn, int width, string text, Font font, ColorScheme scheme) { var nextTopRow = topRow; foreach (var lineOfText in WrapText(text, width, font)) { AddControl(new Label(nextTopRow, leftColumn, lineOfText, font, scheme)); nextTopRow += font.Height; } Bottom = nextTopRow; }
public DynamicLabel( int topRow, int leftColumn, Func<string> textAction, Font font, ColorScheme scheme) : base(topRow, leftColumn, textAction(), font, scheme) { this.textAction = textAction; }
public ExtendedEdit( int topRow, int leftColumn, int width, string text, Font font, ColorScheme scheme, Action<string> action) : base(topRow, leftColumn, width, text, font, scheme, action) { }
public ExtendedLabel( int topRow, int leftColumn, int width, string text, Font font, ColorScheme scheme) : base(topRow, leftColumn, text, font, scheme) { this.width = width; fillScheme = scheme; }
public Toggle( int topRow, int leftColumn, int width, int height, string text, ColorScheme scheme, Font font, Action action) : base(topRow, leftColumn, width, height, text, scheme, font, action) { }
public LabeledValue( int topRow, int leftColumn, string labelText, string valueText, Font font, ColorScheme labelScheme, ColorScheme valueScheme) { this.topRow = topRow; this.leftColumn = leftColumn; this.labelText = labelText; this.valueText = valueText; this.font = font; this.labelScheme = labelScheme; this.valueScheme = valueScheme; }
public Edit( int topRow, int leftColumn, int width, string text, Font font, ColorScheme scheme, Action<string> action) { TopRow = topRow; LeftColumn = leftColumn; Width = width; Text = text; Font = font; Scheme = scheme; this.action = action; }
private static IEnumerable<string> WrapText(string text, int width, Font font) { var wordsOnLine = new List<string>(); foreach (var word in text.Split(' ')) { var lineWithoutWord = string.Join(" ", wordsOnLine); wordsOnLine.Add(word); var lineWithWord = string.Join(" ", wordsOnLine); if (font.MeasureString(lineWithWord) <= width) continue; yield return lineWithoutWord; wordsOnLine.Clear(); wordsOnLine.Add(word); } if (wordsOnLine.Any()) yield return string.Join(" ", wordsOnLine); }
public Button( int topRow, int leftColumn, int width, int height, string text, ColorScheme scheme, Font font, Action action) { this.topRow = topRow; this.leftColumn = leftColumn; this.width = width; this.height = height; this.text = text; this.scheme = scheme; this.font = font; Action = action; Visible = true; }