/ / C#PropertyGridヘルプ領域がサイズ変更/ペイント時に更新されない-c#、propertygrid

C#PropertyGridヘルプ領域がサイズ変更/ペイント時に更新されない - c#、propertygrid

プロパティグリッドがサイズ変更して再描画すると、プロパティグリッドのヘルプ領域は適切にサイズ変更されないようです。グリッドが作成された元のサイズを保持し、残りの領域は汚れたままです(写真では汚れた領域は背景ウィンドウ(Bk Win)。

PropertyGrid

汚れた領域が適切に再描画されるように、ヘルプ領域も適切にサイズ変更されていることを確認する方法はありますか?

ありがとう

回答:

回答№1は0

DocCommentのコントロールは自動的に更新されないようです(.NETのバグ?)。しかし、ここに簡単な解決策があります。

 
private void PropertyGrid_Resize(object sender, EventArgs e)
{
foreach (Control control in (sender as PropertyGrid).Controls)
if (control.GetType().Name == "DocComment")
{
FieldInfo fieldInfo = control.GetType().BaseType.GetField("userSized",
BindingFlags.Instance |
BindingFlags.NonPublic);
fieldInfo.SetValue(control, true);
control.Width = (sender as PropertyGrid).Width;
foreach (Control ctrl in control.Controls)
{
ctrl.Width = control.Width;
}
return;
}
}