自画控件最大化问题
我在一个tablelayoutpanel中一个方格中自画了一个椭圆形按钮,
用的代码如下 System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();
             path.AddEllipse(this.button10.ClientRectangle);
             this.button10.Region = new Region(path);
并且把Dock属性设置为了fill,可是窗口最大化后这个椭圆形按钮却没有随着填充变大的方格??(如果是原先长方形按钮就可以)
如何解决?为什么?
------解决方案--------------------
public class Button : Control
   {
       protected override void OnPaint(PaintEventArgs e)
       {
           base.OnPaint(e);
           GraphicsPath path = new GraphicsPath();
           path.AddEllipse(this.ClientRectangle);
           this.Region = new Region(path);  
       }
       // This is also ok.
       //protected override void OnSizeChanged(EventArgs e)
       //{
       //    base.OnSizeChanged(e);
       //    this.Refresh();
       //}
       protected override void OnResize(EventArgs e)
       {
           base.OnResize(e);
           this.Invalidate();
       }
   }