mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 03:05:40 +00:00
Fix vertical position of text in single-line edit controls.
svn path=/trunk/; revision=11851
This commit is contained in:
parent
d899ea5ca7
commit
947403dfc8
1 changed files with 36 additions and 6 deletions
|
@ -2245,13 +2245,39 @@ static void EDIT_SetCaretPos(EDITSTATE *es, INT pos,
|
||||||
*/
|
*/
|
||||||
static void EDIT_SetRectNP(EDITSTATE *es, LPRECT rc)
|
static void EDIT_SetRectNP(EDITSTATE *es, LPRECT rc)
|
||||||
{
|
{
|
||||||
|
RECT ClientRect;
|
||||||
|
LONG_PTR ExStyle;
|
||||||
|
|
||||||
CopyRect(&es->format_rect, rc);
|
CopyRect(&es->format_rect, rc);
|
||||||
if (es->style & WS_BORDER) {
|
if (es->style & ES_MULTILINE)
|
||||||
INT bw = GetSystemMetrics(SM_CXBORDER) + 1;
|
{
|
||||||
es->format_rect.left += bw;
|
if (es->style & WS_BORDER) {
|
||||||
es->format_rect.top += bw;
|
INT bw = GetSystemMetrics(SM_CXBORDER) + 1;
|
||||||
es->format_rect.right -= bw;
|
es->format_rect.left += bw;
|
||||||
es->format_rect.bottom -= bw;
|
es->format_rect.right -= bw;
|
||||||
|
es->format_rect.top += bw;
|
||||||
|
es->format_rect.bottom -= bw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ExStyle = GetWindowLongPtrW(es->hwndSelf, GWL_EXSTYLE);
|
||||||
|
if (ExStyle & WS_EX_CLIENTEDGE) {
|
||||||
|
if (es->line_height + 2 <=
|
||||||
|
es->format_rect.bottom - es->format_rect.top) {
|
||||||
|
es->format_rect.top++;
|
||||||
|
es->format_rect.bottom--;
|
||||||
|
}
|
||||||
|
} else if (es->style & WS_BORDER) {
|
||||||
|
INT bw = GetSystemMetrics(SM_CXBORDER) + 1;
|
||||||
|
es->format_rect.left += bw;
|
||||||
|
es->format_rect.right -= bw;
|
||||||
|
if (es->line_height + 2 * bw <=
|
||||||
|
es->format_rect.bottom - es->format_rect.top) {
|
||||||
|
es->format_rect.top += bw;
|
||||||
|
es->format_rect.bottom -= bw;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
es->format_rect.left += es->left_margin;
|
es->format_rect.left += es->left_margin;
|
||||||
es->format_rect.right -= es->right_margin;
|
es->format_rect.right -= es->right_margin;
|
||||||
|
@ -2283,6 +2309,10 @@ static void EDIT_SetRectNP(EDITSTATE *es, LPRECT rc)
|
||||||
/* Windows doesn't care to fix text placement for SL controls */
|
/* Windows doesn't care to fix text placement for SL controls */
|
||||||
es->format_rect.bottom = es->format_rect.top + es->line_height;
|
es->format_rect.bottom = es->format_rect.top + es->line_height;
|
||||||
|
|
||||||
|
/* Always stay within the client area */
|
||||||
|
GetClientRect(es->hwndSelf, &ClientRect);
|
||||||
|
es->format_rect.bottom = min(es->format_rect.bottom, ClientRect.bottom);
|
||||||
|
|
||||||
if ((es->style & ES_MULTILINE) && !(es->style & ES_AUTOHSCROLL))
|
if ((es->style & ES_MULTILINE) && !(es->style & ES_AUTOHSCROLL))
|
||||||
EDIT_BuildLineDefs_ML(es, 0, strlenW(es->text), 0, NULL);
|
EDIT_BuildLineDefs_ML(es, 0, strlenW(es->text), 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue