CMonthCalCtrl::SetDayState
Month calendar 컨트롤에서 일에 대 한 표시를 설정합니다.
BOOL SetDayState(
int nMonths,
LPMONTHDAYSTATE pStates
);
매개 변수
nMonths
배열 요소가 개수를 나타내는 값은 pStates 를 가리킵니다.pStates
에 대 한 포인터는 MONTHDAYSTATE month calendar 컨트롤에 표시 매일을 그리는 방법을 정의 하는 값 배열입니다. MONTHDAYSTATE 데이터 형식 (1-31) 각 비트 상태를 하루에 한 달에을 나타내는 비트 필드입니다. 비트가 설정 되 면 해당 요일이 표시는 굵게. 그렇지 않으면 없음으로 강조 표시 됩니다.
반환 값
성공 하면 0이 아닌. 그렇지 않으면 0입니다.
설명
이 멤버 함수는 Win32 메시지의 동작을 구현 MCM_SETDAYSTATE에 설명 된 대로, 여 Windows SDK.
예제
void CMonthCalDlg::OnBnClickedDaystatebutton()
{
// First, we must find the visible range. The array we pass to the
// SetDayState() function must be large enough to hold days for all
// of the visible months. Even if a month is _partially_ visible,
// we must have MONTHDAYSTATE data for it in the array we pass.
// GetMonthRange() returns the range of days currently visible in
// the control, along with a count of visible months. This array
// will be up to 2 months larger than the number of "pages" visible
// in the control.
SYSTEMTIME timeFrom;
SYSTEMTIME timeUntil;
int nCount = m_calCtrl1.GetMonthRange(&timeFrom, &timeUntil, GMR_DAYSTATE);
// Allocate the state array based on the return value.
LPMONTHDAYSTATE pDayState;
pDayState = new MONTHDAYSTATE[nCount];
memset(pDayState, 0, sizeof(MONTHDAYSTATE) * nCount);
// Find the first fully visible month.
int nIndex = (timeFrom.wDay == 1) ? 0 : 1;
// Set the 4th day, 19th day, and 26th day of the first
// _fully_ visible month as bold.
pDayState[nIndex] |= 1 << 3; // 4th day
pDayState[nIndex] |= 1 << 18; // 19th day
pDayState[nIndex] |= 1 << 25; // 25th day
// Set state and clean up
VERIFY(m_calCtrl1.SetDayState(nCount, pDayState));
delete [] pDayState;
}
요구 사항
헤더: afxdtctl.h