设计时还是运行时放大缩小?在调用窗体的Resize事件里处理代码吧
this.UserControl1.size=new size(this.Width/2,this.Heigth/2);

解决方案 »

  1.   

    运行到时可以用楼上方法,如果设计要anchor就好
      

  2.   

    在你的控件上添加如下的代码,复制粘贴一下就OK了:
    private const int WM_NCHITTEST = 0x84; //移动鼠标,按住或释放鼠标时发生的系统消息
    private const int HTCLIENT = 0x1;//工作区
    private const int HTSYSMENU = 3;//系统菜单
    private const int HTCAPTION = 0x2; //标题栏private const int HTLEFT = 10;//向左
    private const int HTRIGHT = 11;//向右
    private const int HTTOP = 12;//向上
    private const int HTTOPLEFT = 13;//向左上
    private const int HTTOPRIGHT = 14;//向右上
    private const int HTBOTTOM = 15;//向下
    private const int HTBOTTOMLEFT = 16;//向左下
    private const int HTBOTTOMRIGHT = 17;//向右下
    private int m_BorderWidth = 2;//可以调整窗体的大小和移动窗体的位置
    protected override void WndProc(ref Message m)
    {
    //System.Console.WriteLine(m.Msg.ToString("X"));
    if (m.Msg == WM_NCHITTEST)
    {
    base.WndProc(ref m);
    if (DesignMode)
    {
    return;
    }
    if ((int)m.Result == HTCLIENT)
    {
    m.HWnd = this.Handle; System.Drawing.Rectangle rect =  this.RectangleToScreen(this.ClientRectangle);
    Point C_Pos = Cursor.Position; if ((Cursor.Position.X<=rect.Left + m_BorderWidth) && (C_Pos.Y <= rect.Top + m_BorderWidth))
    m.Result = (IntPtr)HTTOPLEFT;//左上
    else if ((C_Pos.X>=rect.Left + rect.Width-m_BorderWidth) && (C_Pos.Y<=rect.Top +m_BorderWidth))
    m.Result = (IntPtr)HTTOPRIGHT;//右上
    else if ((C_Pos.X <= rect.Left + m_BorderWidth) && (C_Pos.Y>=rect.Top + rect.Height-m_BorderWidth))
    m.Result = (IntPtr)HTBOTTOMLEFT;//左下
    else if ((C_Pos.X>=rect.Left + rect.Width-m_BorderWidth) && (C_Pos.Y>=rect.Top + rect.Height-m_BorderWidth))
    m.Result = (IntPtr)HTBOTTOMRIGHT;//右下
    else if (C_Pos.X<=rect.Left + m_BorderWidth-1)
    m.Result = (IntPtr)HTLEFT;//左
    else if (C_Pos.X>=rect.Left + rect.Width-m_BorderWidth)
    m.Result = (IntPtr)HTRIGHT;//右
    else if (C_Pos.Y<=rect.Top + m_BorderWidth-1)
    m.Result = (IntPtr)HTTOP;//上
    else if (C_Pos.Y>=rect.Top + rect.Height-m_BorderWidth)
    m.Result = (IntPtr)HTBOTTOM;//下
    }
    return;
    }
    else
    {
    base.WndProc(ref m);
    }
    }
      

  3.   

    设置控件的Anchor属性为Top,Left,Bottom,Right,控件就会自动根据窗体大小变化而变化。
    (只对大小能变化的控件有效,比如textbox是singleline的话,控件只会发生长度的变化)