Ok, I've added the paint event handler by adding it manually to the source files. It sort of works, but not quite yet.
The paint event is not called when the wxTextCtrl is resized, the drawn line dissapears when that happens (it is redrawn but the paint event is somehow bypassed). Enabling wxFULL_REPAINT_ON_RESIZE for the wxTextCtrl has no effect. So I also added a Size event handler, that problem is solved. But the wxTextCtrl is inside a wxNoteBook as a page. When I switch pages the line also dissapears. Redrawing the line in the notebook's page-changed or page-chaging-event handler has no effect.
Am I overlooking something? Isn't there one location where I can add the code so that it always affects the look of the wxTextCtrl?