Reputation: 7271
newbie with windows gui programming here. Has Anyone got an idea how to resize controls in a windows form when the form is resized. In wxpython, it was done with the sizers but I cannot seem to find anything similar when developing guis with windows visual c++
Upvotes: 0
Views: 2435
Reputation: 3695
A control has a member called "Anchor". You can see it from the editor. If you want the object to keep its positioning in all four corners of it's rectangle you can simply enable all of the sub properties under Anchor.
You can read more about the member here: Microsoft.com/Anchor. If you want to dynammicly enable the properties of an control you can simply use this example:
Control.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
Upvotes: 5