- PR -

VS.NET プロパティウィンドウのカスタマイズ

投稿者投稿内容
AKIHIRO-T
会議室デビュー日: 2005/02/14
投稿数: 5
投稿日時: 2005-11-25 09:32
おはようございます。

このような場合、以下のようにControlDesignerクラスのPostFilterPropertiesメソッドをオーバーライドすればいいと思います。

コード:
namespace CustomControl
{
  public class CustomLabelDesigner : System.Windows.Forms.Design.ControlDesigner
  {
      protected override void PostFilterProperties(IDictionary properties)
      {
          //プロパティウィンドウから削除したいプロパティをproperties.Removeで指定する
          properties.Remove("AutoSize");
          properties.Remove("BackColor");
          properties.Remove("BorderStyle");
      }
  }

  [Designer(typeof(CustomLabelDesigner))]
  public class CustomLabel : System.Windows.Forms.Label
  {
    public CustomLabel()
    {
    }
  }
}

RAY
会議室デビュー日: 2005/11/10
投稿数: 7
投稿日時: 2005-11-25 20:08
ご回答いただいた方、ありがとうございました。
カスタマイズができました。
また、調査不足な点、申し訳ありませんでした。

スキルアップ/キャリアアップ(JOB@IT)