WHAT I HAVE:
Visual Basic 2019, WinForms, .NET 4+
MY PROBLEM:
I've created an extended-function rich-text UserControl that uses a RichTextBox as a child constituent control, and I want to use the SetWindowsSubclass on the constituent control to display page breaks when the text-box repaints (RichTextBox--and TextBox, for that matter--don't fire Paint events). I could create an extended control that inherits from the RichTextBox, and use that as the constituent control within my UserControl (relying on WndProc)--but that means adding an additional level of complexity and an additional project to my class-library solution--and it means end users will have to reference an additional library besides the UserControl library in order to place my UserControl into a host project! (They already have to reference an extra one on account of the spell-checker!)
I've been able to use SetWindowSubclass on a regular RichTextBox from within a form, but when I try to port the code to my UserControl code, it (apparently) sucessfully installs the subclass, but it doesn't fire the subclass procedure designed to handle the WM_PAINT message. It works fine when the RichTextBox is directly on a form, but not when it's a constituent inside a UserControl!
What am I doing wrong?! I need an answer ASAP, and in VB.NET.
PS. My tentative solution is to place the page-break drawing code inside of a Timer_Tick event that fires every so many times a second. The result is that the page-breaks have to be continually updated--even when text isn't changed, which shouldn't be necessary, but it is when done this way ('cause there's no way to know when the control will be repainted)--and there's flicker with respect to the page-break lines every time text is changed.