Returns the size a control needs for its contents.
C
void WINAPI SftDate_GetPreferredSize(HWND hwndCtl, LPSIZE lpSize);
C++
void CSftDate::GetPreferredSize(LPSIZE lpSize) const; void CSftCalendar::GetPreferredSize(LPSIZE lpSize) const;
hwndCtl
The window handle of the date field control (SftDate) or the month calendar control (SftCalendar).
lpSize
A pointer to a SIZE structure that receives the width and height in pixels.
The GetPreferredSize function returns the window size a control needs. For a month calendar control, it is the size of all months shown (SetMonthsAcross, SetMonthsDown) with the Today and Clear buttons and the border. For a date field control, the width fits the current value with the check box and buttons, and the height is GetPreferredHeight.
The size depends on the font, the culture and the DPI of the monitor (GetDPI). A control that sizes itself (SetAutoSize) uses it automatically. If hwndCtl is not a date field or month calendar control, the size is 0.
See Also C/C++ API | Categories | Notifications