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
calculation:
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?
Thanks,
Novice