public void AddBookButton(BookButtonTitles title) { Button button = new Button(buttonWidth, buttonHeight) { Position = new Point(buttonGutter, buttonIndex += buttonHeight), // Add increment to call Text = title.ToString(), }; button.Theme = new BookButtonTheme(); Add(button); }
public override void UpdateAndDraw(ControlBase control, TimeSpan time) { if (!(control is Button button) || !button.IsDirty) { return; } RefreshTheme(control.ThemeColors, control); Cell appearance = GetStateAppearance(control.State); // Redraw the control button.Surface.Fill( appearance.Foreground, appearance.Background, appearance.Glyph, null); // Draw Filigrees int nonFiligreeValueSkip = 2; BookButtonTitles spine = Enum.Parse <BookButtonTitles>(button.Text); string[] filigree = bookFiligrees[spine]; Color fColorB = XNAColor(System.Drawing.Color.FromKnownColor(Enum.Parse <KnownColor>(filigree[1]))); Color fColorA = ColorShiftTorchlight(fColorB); Color fColorC = ColorShiftShadow(fColorB); List <Color> fColors = new List <Color> { fColorA, fColorB, fColorC }; Color bgColorB = XNAColor(System.Drawing.Color.FromKnownColor(Enum.Parse <KnownColor>(filigree[0]))); Color bgColorA = ColorShiftTorchlight(bgColorB); Color bgColorC = ColorShiftShadow(bgColorB); List <Color> bgColors = new List <Color> { bgColorA, bgColorB, bgColorC }; for (int i = nonFiligreeValueSkip; i < 3 + nonFiligreeValueSkip; i++) { button.Surface.Print(0, i - nonFiligreeValueSkip, filigree[i].ToAscii().Align(button.TextAlignment, button.Width), fColors[i - nonFiligreeValueSkip], bgColors[i - nonFiligreeValueSkip]); } button.IsDirty = false; }