void CChildView::OnPaint()
{
CPaintDC dc(this); // 그리기를 위한 디바이스 컨텍스트입니다.
POINT ptArray[][8] = {
{ {10, 10}, {110, 10}, {210, 10}, {310, 10}, {410, 10}, {510, 10}, {610, 10}, {710, 10} },
{ {10, 110}, {110, 110}, {210, 110}, {310, 110}, {410, 110}, {510, 110}, {610, 110}, {710, 110} },
{ {10, 210}, {110, 210}, {210, 210}, {310, 210}, {410, 210}, {510, 210}, {610,210}, {710,210} },
{ {10, 310}, {110, 310}, {210, 310}, {310, 310}, {410, 310}, {510, 310}, {610, 310}, {710, 310} },
{ {10, 410}, {110, 410}, {210, 410}, {310, 410}, {410, 410}, {510, 410}, {610, 410}, {710, 410} },
{ {10, 510}, {110, 510}, {210, 510}, {310, 510}, {410, 510}, {510, 510}, {610, 510}, {710, 510} },
{ {10, 610}, {110, 610}, {210, 610}, {310, 610}, {410, 610}, {510, 610}, {610, 610}, {710, 610} },
};
CString strProp[] = {
"", "", "", "", "", "", "1"
};
CString strAccu[] = {
"2", "3", "4", "5", "6", "7", "8"
};
CString strAccu1[] = {
"9", "10", "11", "12", "13", "14", "15"
};
CString strAccu2[] = {
"16", "17", "18", "19", "로", "21", "22"
};
CString strAccu3[] = {
"23", "24", "25", "26", "27", "28", "29"
};
// 회색 배경, 굵은 선
dc.SelectStockObject(LTGRAY_BRUSH);
CPen penThick(PS_SOLID, 2, RGB(0, 0, 0));
dc.SelectObject(&penThick);
dc.Rectangle( CRect(ptArray[0][0], ptArray[1][7]) );
// 굵은 선
dc.SelectStockObject(WHITE_BRUSH);
dc.Rectangle( CRect(ptArray[1][0], ptArray[6][7]) );
// 보통 선
dc.SelectStockObject(BLACK_PEN);
// (가로 선)
for (int i=2; i<6; i++)
{
dc.MoveTo(ptArray[i][0]);
dc.LineTo(ptArray[i][7]);
}
// (세로 선)
for (int i=1; i<7; i++)
{
dc.MoveTo(ptArray[0][i]);
dc.LineTo(ptArray[6][i]);
}
// 보통 글자
dc.SelectStockObject(SYSTEM_FONT);
dc.SetBkMode(TRANSPARENT);
for (int j=0; j<7; j++)
{
dc.DrawText(strProp[j], strProp[j].GetLength(),
CRect(ptArray[1][j], ptArray[2][j+1]),
DT_CENTER|DT_VCENTER|DT_SINGLELINE);
dc.DrawText(strAccu[j], strAccu[j].GetLength(),
CRect(ptArray[2][j], ptArray[3][j+1]),
DT_CENTER|DT_VCENTER|DT_SINGLELINE);
dc.DrawText(strAccu1[j], strAccu[j].GetLength(),
CRect(ptArray[3][j], ptArray[4][j+1]),
DT_CENTER|DT_VCENTER|DT_SINGLELINE);
dc.DrawText(strAccu2[j], strAccu[j].GetLength(),
CRect(ptArray[4][j], ptArray[5][j+1]),
DT_CENTER|DT_VCENTER|DT_SINGLELINE);
dc.DrawText(strAccu3[j], strAccu[j].GetLength(),
CRect(ptArray[5][j], ptArray[6][j+1]),
DT_CENTER|DT_VCENTER|DT_SINGLELINE);
}
// 굵은 글자
LOGFONT lf;
CFont *pFontCurrent = dc.GetCurrentFont();
pFontCurrent->GetLogFont(&lf);
lf.lfWeight = FW_BOLD;
CFont fontBold;
fontBold.CreateFontIndirect(&lf);
dc.SelectObject(&fontBold);
for (int k=1; k<7; k++)
{
CString str;
str.Format("%d", k);
dc.DrawText(str, str.GetLength(),
CRect(ptArray[0][k], ptArray[1][k+1]),
DT_CENTER|DT_VCENTER|DT_SINGLELINE);}
// TODO: 여기에 메시지 처리기 코드를 추가합니다.
// 그리기 메시지에 대해서는 CWnd::OnPaint()를 호출하지 마십시오.
}
이렇게해서 달력만들려고하는데 맨윗줄을 월~일로 바꾸는거랑
각칸에 날짜 넣고싶은데 제대로 안나와요. 좀도와주세요.
굉장한 하드코어로군
매달 릴리즈를 새로 해야겠군요... 이런게 바로 창조경제죠.