comctl32/datetime: Draw field text horizontally centered.
This commit is contained in:
parent
f27e37a22f
commit
d083e7701b
|
@ -712,12 +712,13 @@ DATETIME_Refresh (DATETIME_INFO *infoPtr, HDC hdc)
|
||||||
/* fill if focused */
|
/* fill if focused */
|
||||||
HBRUSH hbr = CreateSolidBrush (comctl32_color.clrActiveCaption);
|
HBRUSH hbr = CreateSolidBrush (comctl32_color.clrActiveCaption);
|
||||||
|
|
||||||
selection.right = field->right;
|
selection.left = 0;
|
||||||
selection.left = selection.right - size.cx;
|
|
||||||
selection.top = 0;
|
selection.top = 0;
|
||||||
|
selection.right = size.cx;
|
||||||
selection.bottom = size.cy;
|
selection.bottom = size.cy;
|
||||||
/* center rectangle */
|
/* center rectangle */
|
||||||
OffsetRect(&selection, 0, (field->bottom - size.cy)/2);
|
OffsetRect(&selection, (field->right + field->left - size.cx)/2,
|
||||||
|
(field->bottom - size.cy)/2);
|
||||||
|
|
||||||
FillRect(hdc, &selection, hbr);
|
FillRect(hdc, &selection, hbr);
|
||||||
DeleteObject (hbr);
|
DeleteObject (hbr);
|
||||||
|
@ -727,7 +728,7 @@ DATETIME_Refresh (DATETIME_INFO *infoPtr, HDC hdc)
|
||||||
oldTextColor = SetTextColor (hdc, comctl32_color.clrWindowText);
|
oldTextColor = SetTextColor (hdc, comctl32_color.clrWindowText);
|
||||||
|
|
||||||
/* draw the date text using the colour set above */
|
/* draw the date text using the colour set above */
|
||||||
DrawTextW (hdc, txt, strlenW(txt), field, DT_RIGHT | DT_VCENTER | DT_SINGLELINE);
|
DrawTextW (hdc, txt, strlenW(txt), field, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
|
||||||
SetTextColor (hdc, oldTextColor);
|
SetTextColor (hdc, oldTextColor);
|
||||||
}
|
}
|
||||||
SetBkMode (hdc, oldBkMode);
|
SetBkMode (hdc, oldBkMode);
|
||||||
|
|
Loading…
Reference in New Issue