Can I paint the electrical panel?
What you "heard" is incorrect, but Harper's advice is wise just the same.

You can paint the outer cover of the panel as long as you don't obscure any critical labels. Use a good primer and several thin topcoats to prevent runs and avoid filling stamped text. I'd probably remove the plastic latch, mask the opening from behind, and reinstall it later for a more professional appearance (or simply mask it in place).