C # Winforms without resizing arrows using GrowAndShrink

I have winform with picture box, button and menustrip. The picture box is tied to all sides, so when I resize the form, the image also changes. I set the minimum size for the form to 700x600.

But this only works when the form is set to AutoSizeMode = GrowOnly. If I switch to AutoSizeMode = GrowAndShrink, the diagonal <=> will reduce the size of the arrow.

If I set SizeGripStyle = Show on form, I can get an arrow to display and “resize”, but as I drag it to resize, it just flickers very quickly and returns to the default size.

How can I do this GrowAndShrink instead of just GrowOnly?

+5
source share
2 answers

Make sure the form properties have the following values:

AutoSize: false (sounds like it should be true, but set this to false).
AutoSizeMode: GrowOnly (like above, sounds like it should be GrowAndShrink)
MinimumSize: Not important. set to 1, 1 for now. Is just to stop resizing getting too small.
MaximumSize: Not important. set to 1, 1. As above (MinimumSize).
SizeGripStyle: Not important. Set to Show. 

Finally, make sure you use snapping or docking to adjust the width of the control when resizing the form. Installing controls with a width can prevent shape changes.

+6
source

Try setting the image window to AutoSizeMode = GrowAndShrink. Usually I leave the AutoSizedMode = GrowOnly form, because if you forget to set some of the minimum sizes on your controls, it will always try to be the minimum size.

0
source

All Articles