private void WLPaintControl(Control ctl, Graphics graphics) { // draw the control and any child controls if (ctl is Container) { foreach (Control ctl1 in (ctl as Container).Controls) { WLPaintControl(ctl1, graphics); } } else { Guid id = ThemeComponentGuid.FromControlType(ctl.GetType()); Guid stateId = ThemeComponentStateGuids.Normal; if (ctl == mvarFocusedControl) { if (ctl == mvarPressedControl) { stateId = ThemeComponentStateGuids.PressedFocused; } else if (ctl == mvarHoverControl) { stateId = ThemeComponentStateGuids.HoverFocused; } else { stateId = ThemeComponentStateGuids.NormalFocused; } } else if (ctl == mvarPressedControl) { stateId = ThemeComponentStateGuids.Pressed; } else if (ctl == mvarHoverControl) { stateId = ThemeComponentStateGuids.Hover; } Dictionary<string, object> dict = new Dictionary<string, object>(); dict.Add("Component.Text", ctl.Text); graphics.DrawThemeComponent(new ThemeComponentReference(id, stateId), ctl, dict); ctl.OnPaint(new PaintEventArgs(graphics)); } }