Mono WinForms layout and invalidate issues
Jul 19 2010 ยท Mono
Issue 1: Layout of anchored, non-visible control
I had a custom subcontrol anchored left and right within a parent control. The subcontrol was not visible and would only appear when I called a function to make it visible. The parent control had a default width and height, of course, but would be resized as necessary when placed on a form. With Mono, after being placed on a form, the anchoring seems to take effect based on the default dimensions of the control, not the dimensions of it in the form. This, of course, results in the subcontrol being an incorrect size and position.
I haven’t found a solution to this issue as yet.
Issue 2: Repaint after SuspendLayout/ResumeLayout
When adding a number of custom subcontrols (Dock=Top) to a Panel, I called SuspendLayout() before adding them, and called ResumeLayout() after. The height of the controls are adjusted right after they are added to automatically fit a word-wrapped block of text. On Mono, the Panel is never repainted (meaning the custom controls are never repainted either, and its text is not shown).
Calling Refresh() or Invalidate() after ResumeLayout() solves this issue.