469,962 Members | 2,281 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,962 developers. It's quick & easy.

Increasing client size to accomodate contents (so scroll bars appear)

Hi all, I have a class (call it class A) that extends UserControl
(there is no reason that this couldn't extend Panel). I have a few
PictureBox objects in class A. When I increase the size of the
pictures in the PictureBox objects, I would also like to increase the
window, so that the scroll bars appear. For some reason none of the
following methods force the scroll bars to appear:
this.ClientSize = new Size(layout_w, layout_h);
this.Size = new Size(layout_w, layout_h);;
this.Height = layout_h;
this.Width = layout_w;

However, for some reason:
Scale (clientWidthScaleFactor, clientHeightScaleFactor);
does increase the size of the client area so that the scroll bars
appear. Unfortunately, this requires me to do the following
float clientHeightScaleFactor = layout_h / (float)(this.Height);
float clientWidthScaleFactor = layout_w / (float)(this.Width);

This leads to inaccuracies and will either result in me having to add a
buffer to the above in which case the area of the client window is
almost always too large or almost always undersized. Obviously being
too large is preferable so that the user can actually see the images -
but this is sloppy and a hack.

I would prefer just to tell the client window exactly how large I
expect it to be.

What do I need to do in order to get the client window to increase
according to an absolute specification of height and width?


Nov 17 '05 #1
0 1128

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by David Rwj Cherry CS2000 | last post: by
reply views Thread by Axel Dahmen | last post: by
5 posts views Thread by Aidan | last post: by
reply views Thread by Eric | last post: by
4 posts views Thread by Matthew Cox | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.