GdiPlusVisualizer: refactoring (if-then-throw)