Click here to Skip to main content
11,702,168 members (62,950 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C# WinForm
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

Posted 31-Jan-13 16:52pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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[^].


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

  Print Answers RSS
0 Maciej Los 395
1 Sergey Alexandrovich Kryukov 355
2 OriginalGriff 314
3 CHill60 145
4 Mika Wendelius 119
0 OriginalGriff 8,344
1 Sergey Alexandrovich Kryukov 7,507
2 CPallini 4,922
3 Maciej Los 4,371
4 Mika Wendelius 3,556

Advertise | Privacy | Mobile
Web02 | 2.8.150819.1 | Last Updated 31 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100