I am building a simple Border-less WinForms form (essentially setting it to Borderstyle of None), and painting all of the client area and non-client area myself. All works fine, but when i use a derived form (deriving from my custom Border-less form) and open that form in design mode in Visual Studio, and perform any operations such as dragging the corners of the form border to re-size the form, the form does not refresh the painting of the custom borders i draw, until i either switch to another view and come back to the form view or close the form and reopen it.
How do i force or request the VS to force refresh its view so my visual updates are immediately visible rather than closing and re-opening the form design view?
My non-client area and client area drawing works fine at runtime (including when the user re-sizes the form at runtime), but only at design time, i see the problem.
I tried a couple of options:
- Custom Designer
To write my own designer for the border-less form. But that seems to be a very complex task since i have to rewrite the entire implementation of a designer just like MS's FormDocumentDesigner class (it is internal - so I cannot derive from it) by deriving from DocumentDesigner class.
Since it is so complex to do this option, i have dropped this idea.
- Override Size property or OnSizeChanged member: Tried to override (new) the Size property of the Form class and force my form to redraw. This did not work.
Any other ideas/options? Please advise.