Fix add/remove template buttons overlapping the list (Dock add-order bug)
WinForms docks child controls in the REVERSE of their Controls.Add() order - the last control added gets docked first (claims its edge space first), and earlier-added controls lay out against whatever remains. pnlTemplateButtons (Dock=Top) was added before lstTemplates (Dock=Fill), so Fill was processed first against the full, unclaimed panel area and expanded to cover the whole thing - overlapping the button strip instead of leaving room for it. Swapped the add order (Fill first, Top second) so the button strip actually carves out its band before Fill claims what's left. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f1c67669fd
commit
b42815aa2a
1 file changed
+17
-5
@@ -253,12 +253,24 @@ namespace BulkArchiveMailer.AddIn.UI
|
|||||||
this.pnlTemplateList.Size = new System.Drawing.Size(190, 467);
|
this.pnlTemplateList.Size = new System.Drawing.Size(190, 467);
|
||||||
this.pnlTemplateList.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
this.pnlTemplateList.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||||
| System.Windows.Forms.AnchorStyles.Left)));
|
| System.Windows.Forms.AnchorStyles.Left)));
|
||||||
// Dock order matters here: pnlTemplateButtons (Dock=Top) is
|
// Dock order matters here, and it is the OPPOSITE of what looks
|
||||||
// added FIRST, lstTemplates (Dock=Fill) SECOND, so the Fill
|
// intuitive: WinForms lays out docked children in the REVERSE
|
||||||
// control's layout is computed against whatever client area
|
// of their Controls.Add() order - the LAST control added is
|
||||||
// remains under the already-docked top strip.
|
// docked FIRST (closest to the parent's edge), and each
|
||||||
this.pnlTemplateList.Controls.Add(this.pnlTemplateButtons);
|
// earlier-added control is then laid out against whatever
|
||||||
|
// client area is left over. So lstTemplates (Dock=Fill) must be
|
||||||
|
// added FIRST, and pnlTemplateButtons (Dock=Top) must be added
|
||||||
|
// SECOND/last, so that the Top strip is actually the one that
|
||||||
|
// gets docked last (i.e. first in effect) and carves its 35px
|
||||||
|
// band out of the top; Fill then only gets whatever remains
|
||||||
|
// below it. Adding them in the other order (as this used to be)
|
||||||
|
// makes Fill get laid out first, against the FULL panel client
|
||||||
|
// area (nothing has carved out the top strip yet), so it
|
||||||
|
// expands to cover the entire panel and visually overlaps
|
||||||
|
// pnlTemplateButtons - exactly the "buttons overlap the list"
|
||||||
|
// bug reported on the real machine.
|
||||||
this.pnlTemplateList.Controls.Add(this.lstTemplates);
|
this.pnlTemplateList.Controls.Add(this.lstTemplates);
|
||||||
|
this.pnlTemplateList.Controls.Add(this.pnlTemplateButtons);
|
||||||
|
|
||||||
// pnlTemplateButtons
|
// pnlTemplateButtons
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in new issue
Block a user