0

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

プロパティ グリッド

ダーティ エリアが適切に再描画されるように、ヘルプ エリアも適切にサイズ変更されていることを確認する方法はありますか?

ありがとう

4

1 に答える 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;
    }            
}
 
于 2012-07-11T13:42:00.317 に答える