Click here to Skip to main content
15,880,405 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello Every One

I am very much new to this C# and WinForms. Recently I was programming a WinForms application using C#. I Have a group box in a Window. The when I try to Maximize/ Resize the window. It is missing the alignment of its parent container which is the Window. I tried Anchoring etc., whatever the controls I know to solve this issue. So please let me know whether there is any direct approach or any other approach to solve this problem.

Thanks in Advance

Sri
Posted

1 solution

The best approach to this is the combination of the properties System.Windows.Forms.Controls.Dock and System.Windows.Forms.Controls.Padding. In certain cases, Anchor is also helpful, but use it with care, as it tends to cause more flicker (essentially, main reason for it is that some native Windows controls wrapped as Forms control classes are very old; they were created when computer performance was no good enough to allow for effective measures against flicker).

Basically, all the design is based on many panels nested in required way, with other controls docked in leaves of such panel tree, without the use of System.Windows.Forms.DockStyle.None.

In my past answer, I provided a rudimentary code sample to illustrate the idea: how to dock button so that it can adjust with the form[^].

Please see also:
Zom Out malfunctions when Screen resolution changes[^],
GUI Apperance - C#.Net[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900