none
开发用户控件,如何设置不让用户调整控件大小? RRS feed

答案

  • 你好:

    参考以下MSDN文档:

    http://msdn.microsoft.com/en-us/library/system.windows.forms.control.setboundscore.aspx

    可以通过重写SetBoundsCore方法来设置一个固定的长度和宽度,这样在设计时就可以防止其他使用该控件的开发人员调整控件大小:

    protected override void SetBoundsCore(int x, int y, 
       int width, int height, BoundsSpecified specified)
    {
       // Set a fixed height and width for the control. 
       base.SetBoundsCore(x, y, 150, 75, specified);
    }
    


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • 已标记为答案 vboykk 2014年10月27日 10:50
    2014年10月27日 9:33
    版主