On Mar 6, 10:24*pm, za...@construction-imaging.com wrote:
> On Mar 6, 12:55*pm, kimiraikkonen <kimiraikkone...@gmail.com> wrote:
>
>
>
>
>
> > On Mar 6, 7:43*pm, za...@construction-imaging.com wrote:
>
> > > I am developing an application in VS2005. I have a form that has a
> > > PictureBox control whose purpose is to be able to plop a User Control
> > > in it. And the User Control can be one of several possible User
> > > Controls and these User Controls are all different in size, some
> > > larger that the picture box it will be added to.
>
> > > How do I get the form to resize when I add a User Control to the
> > > picture box control when the User Control is larger than the picture
> > > box?
>
> > If you're not talking about fitting picturebox on a form which that's
> > higher on screen / desktop resolution (which i'd like to accomplish),
> > and you might have mentioned about a kind of alignment / object
> > fitting issue, i think you should do:
>
> > Picurebox1.size = <User_control>.size ' Assuming user control
> > providing a GUI and size info.
> > ' Apply the same for the form
>
> > Me.size = Picturebox1.size ' Or add some space "Picturebox1.size + 50"
>
> > Hope this helps.
>
> Not "automatic" but it has the distinct advantage of working.
>
> picturebox.Controls.Clear();
> this.Height = this.Height + (usercontrol.Height - picturebox.Height);
> this.Width = this.Width + (usercontrol.Width - picturebox.Width);
> picturebox.Height = usercontrol.Height;
> picturebox.Width = usercontrol.Width;
> picturebox.Controls.Add(usercontrol);
> this.CenterToScreen();- Hide quoted text -
>
> - Show quoted text -
So did it work for you?
|