“继承的控件"请勿调整大小,控件应具有固定大小,用户不能更改大小 [英] "Inherited Control” Do not resize, control should have fix size, user can't change size

查看:46
本文介绍了“继承的控件"请勿调整大小,控件应具有固定大小,用户不能更改大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想制作一个固定大小的控件.
它不应该调整大小,设计时间以及运行时

通过谷歌搜索我知道我必须重写 SetBoundsCore
我尝试过但没有成功.
请帮助我


在此先感谢

I want to make a control with fixed size.
It should not be resized, design time as well as runtime

By googling I come to know I have to override SetBoundsCore
I had tried but not succeed.
Pleae help me


Thanks in advance

推荐答案

大家好
感谢您阅读我的问题
现在可以通过以下代码来解决

Hello All
Thanks for reading my question
Now it is solve by following code

protected override void SetBoundsCore(int x, int y, int width, int height, System.Windows.Forms.BoundsSpecified specified)
        {
            base.SetBoundsCore(x, y, 768, 576, System.Windows.Forms.BoundsSpecified.None);
        }



非常感谢



many thanks


这篇关于“继承的控件"请勿调整大小,控件应具有固定大小,用户不能更改大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆