残念ながら、これを行うための超迅速な方法はないようですが、以下は私の解決策であり、少なくとも偶然に依存していないようです.
mdi コンストラクターで、サイズ変更を処理します。
this.ResizeEnd += delegate { this.Refresh(); };
そして、最大化/復元イベントを処理するためのこのオーバーライド
protected override void WndProc(ref Message m)
{
if (m.Msg == Win32.WM_SYSCOMMAND)
{
int test = m.WParam.ToInt32() & 0xFFF0;
switch (test)
{
case Win32.SC_MAXIMIZE:
case Win32.SC_RESTORE:
this.Invalidate(); // used to keep background image centered
break;
}
}
base.WndProc(ref m);
}
定数値は次のように定義されます。
public const int WM_SYSCOMMAND = 0x0112;
//wparam for WM_SYSCOMMAND should be one of these after masking with 0xFFF0:
public const int SC_RESTORE = 0xF120;
public const int SC_MINIMIZE = 0xF020;
public const int SC_MAXIMIZE = 0xF030;