From a5f3ea9ac12fccbc9faf3f152d4dfbe7f263268e Mon Sep 17 00:00:00 2001 From: Jonas Kümmerlin Date: Thu, 27 Dec 2018 22:54:55 +0100 Subject: make label, edit and button text line up perfectly --- alf/alf.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'alf/alf.cpp') diff --git a/alf/alf.cpp b/alf/alf.cpp index 3bcde5b..2ec33ca 100644 --- a/alf/alf.cpp +++ b/alf/alf.cpp @@ -249,13 +249,20 @@ ALF_ApplyLayout(HWND hwnd, ALFWindowPriv *win) int margintop = ALF_CentipointsToPxPriv(win, c->cptMarginTop); int marginbottom = ALF_CentipointsToPxPriv(win, c->cptMarginBottom); - hdwp = DeferWindowPos(hdwp, - c->hwnd, 0, - win->layout.columns[c->x].allocatedPosition + marginleft, - win->layout.rows[c->y].allocatedPosition + margintop, - win->layout.columns[c->x].allocatedWidth - marginleft - marginright, - win->layout.rows[c->y].allocatedWidth - margintop - marginbottom, - SWP_NOACTIVATE | SWP_NOZORDER); + RECT r = { 0,0,0,0 }; + r.left = win->layout.columns[c->x].allocatedPosition + marginleft; + r.right = r.left + win->layout.columns[c->x].allocatedWidth - marginleft - marginright; + r.top = win->layout.rows[c->y].allocatedPosition + margintop; + r.bottom = r.top + win->layout.rows[c->y].allocatedWidth - margintop - marginbottom; + + if (c->flags & ALF_APPLYSIZE) { + hdwp = (HDWP)SendMessage(c->hwnd, ALF_WM_APPLYSIZE, (WPARAM)hdwp, (LPARAM)&r); + } else { + hdwp = DeferWindowPos(hdwp, + c->hwnd, 0, + r.left, r.top, r.right - r.left, r.bottom - r.top, + SWP_NOACTIVATE | SWP_NOZORDER); + } } EndDeferWindowPos(hdwp); -- cgit v1.2.3