protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime) { // Toggle button in pressed state? if (mode == ButtonMode.PushButton && pushed) { var l = Skin.Layers[lrButton]; renderer.DrawLayer(l, rect, l.States.Pressed.Color, l.States.Pressed.Index); // Does the layer's pressed state have an overlay? if (l.States.Pressed.Overlay) { // Draw the overlay on top of the button. renderer.DrawLayer(l, rect, l.Overlays.Pressed.Color, l.Overlays.Pressed.Index); } } else { // Standard button. ButtonBase can handle drawing. base.DrawControl(renderer, rect, gameTime); } var layer = Skin.Layers[lrButton]; var font = (layer.Text != null && layer.Text.Font != null) ? layer.Text.Font.Resource : null; var col = Color.White; var ox = 0; var oy = 0; // Standard button pressed? if (ControlState == ControlState.Pressed) { if (layer.Text != null) { col = layer.Text.Colors.Pressed; } ox = 1; oy = 1; } // Button has an image to apply? if (glyph != null) { // Draw the button image. var cont = layer.ContentMargins; var r = new Rectangle(rect.Left + cont.Left, rect.Top + cont.Top, rect.Width - cont.Horizontal, rect.Height - cont.Vertical); renderer.DrawGlyph(glyph, r); } else { renderer.DrawString(this, layer, Text, rect, true, ox, oy); } }