开发者

Problem with resizing a form

I'm drawing an image in a form. When the image is too wide, I want to increase the width of the form. Here's how I do it in the constructor:

    ImageForm(String^ _开发者_运维知识库path, int _w, int _h)
    {
        InitializeComponent();
        if(this->ClientSize.Width <= _w)
        {
            this->ClientSize.Width = _w+2;
        }
    }

But it doesn't work. Even if the if-branch gets executed, the width of the form remains unchanged.


Things that you draw are not considers clients since they are not objects, you can notice that if you resize the form manually, they will disappear. this is why we use PictureBox for drawing.

Hope that it's useful.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜