想重写一下Button如何让Button的Size属性编程只读的属性?

解决方案 »

  1.   

     public Size Size
            {
                get
                {
                    return this.Size;
                }
            }
    我这样写好象不对的吧,体统给我一个警告.
    'RuntimeFormDesigner.FlashButton.Size' hides inherited member 'System.Windows.Forms.Control.Size'. Use the new keyword if hiding was intended.
      

  2.   

    这个警告是说你隐藏了基类的Size属性,让你加个new关键字。
    new public Size Size 
            { 
                get 
                { 
                    return this.Size; 
                } 
            } 
      

  3.   

    既然是重写就应该加上override