void ChangedActiveState(Widget widget) { ButtonWidget button = widget as ButtonWidget; if (button != null) { button.RedrawBackground(); RedrawWidget(button); } LabelWidget label = widget as LabelWidget; if (label != null && label.DarkenWhenInactive) { game.ResetArea(label.X, label.Y, label.Width, label.Height); RedrawWidget(label); } BitmapWidget bitmap = widget as BitmapWidget; if (bitmap != null) { RedrawWidget(bitmap); } }
protected void RedrawAllButtonBackgrounds() { int buttons = 0; for (int i = 0; i < widgets.Length; i++) { if (!(widgets[i] is ButtonWidget)) { continue; } buttons++; } if (buttons == 0) { return; } using (FastBitmap bmp = game.LockBits()) { for (int i = 0; i < widgets.Length; i++) { ButtonWidget button = widgets[i] as ButtonWidget; if (button != null) { button.RedrawBackground(bmp); } } } }