win32: if calendar has today string (always true at moment) we need to choose maximal width between calendar rectangle and today string for our control (must fix bug #0012780)

git-svn-id: trunk@19086 -
This commit is contained in:
paul 2009-03-24 06:36:26 +00:00
parent f772d28064
commit b4f0c63393

View File

@ -91,11 +91,21 @@ class procedure TWin32WSCustomCalendar.AdaptBounds(const AWinControl: TWinContro
var
WinHandle: HWND;
lRect: TRect;
TodayWidth: integer;
begin
WinHandle := AWinControl.Handle;
Windows.SendMessage(WinHandle, MCM_GETMINREQRECT, 0, LPARAM(@lRect));
Width := lRect.Right;
Height := lRect.Bottom;
// according to msdn to ensure that today string is not clipped we need to choose
// maximal width between that rectangle and today string width
// this needs to be done only if we are showing today string
if (GetWindowLong(WinHandle, GWL_STYLE) and MCS_NOTODAY) = 0 then
begin
TodayWidth := Windows.SendMessage(WinHandle, MCM_GETMAXTODAYWIDTH, 0, 0);
if Width < TodayWidth then
Width := TodayWidth;
end;
end;
class function TWin32WSCustomCalendar.GetDateTime(const ACalendar: TCustomCalendar): TDateTime;