CGestureHandClosed::CGestureHandClosed() : CDeformableTemplateModel() { SetCenterPoint(SAM::TVector<float, 2>(20.0f, 20.0f), SAM::TVector<BYTE, 3>(0, 0, 0), 255); AddPoint(SAM::TVector<float, 2>(-18.0f, 0.0f), SAM::TVector<BYTE, 3>(255, 255, 255), 0); AddPoint(SAM::TVector<float, 2>(18.0f, 0.0f), SAM::TVector<BYTE, 3>(255, 255, 255), 0); AddPoint(SAM::TVector<float, 2>(0.0f, -18.0f), SAM::TVector<BYTE, 3>(255, 255, 255), 0); }
void CRotateButtonUI::SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue) { if (_tcscmp(pstrName, _T("radius")) == 0) SetRadius(pstrValue); if (_tcscmp(pstrName, _T("centerpoint")) == 0) SetCenterPoint(pstrValue); if (_tcscmp(pstrName, _T("normalimage")) == 0) SetNormalImage(pstrValue); else if (_tcscmp(pstrName, _T("hotimage")) == 0) SetHotImage(pstrValue); else CControlUI::SetAttribute(pstrName, pstrValue); }
void CTestClockDlg::OnSize(UINT nType, int cx, int cy) { if (m_bInit == TRUE) { SetRadius(cx, cy); SetCenterPoint(cx, cy); SetGradationPoints(); m_nHourGradSize = MulDiv(DEFAULT_HOUR_GRAD_SIZE, m_nRadius, m_nRadiusOrg); m_nMinuteGradSize = MulDiv(DEFAULT_MINUTE_GRAD_SIZE, m_nRadius, m_nRadiusOrg); m_nSecondHandSize = MulDiv(DEFAULT_SECOND_HAND_SIZE, m_nRadius, m_nRadiusOrg); m_nCenterPointSize = MulDiv(DEFAULT_CENTER_POINT_SIZE, m_nRadius, m_nRadiusOrg); SetClockHandPoints(); // Set position of the 'OK' and 'Cancel' button CRect rect; CRect rectBtnOk; CRect rectBtnOkToMove; CRect rectBtnCancel; CRect rectBtnCancelToMove; GetClientRect(rect); ClientToScreen(rect); m_btnOk.GetWindowRect(rectBtnOk); ScreenToClient(rectBtnOk); m_btnCancel.GetWindowRect(rectBtnCancel); ScreenToClient(rectBtnCancel); rectBtnOkToMove.right = rect.Width() - m_marginBtnOk.right; rectBtnOkToMove.bottom = rect.Height() - m_marginBtnOk.bottom; rectBtnOkToMove.left = rectBtnOkToMove.right - rectBtnOk.Width(); rectBtnOkToMove.top = rectBtnOkToMove.bottom - rectBtnOk.Height(); rectBtnCancelToMove.right = rect.Width() - m_marginBtnCancel.right; rectBtnCancelToMove.bottom = rect.Height() - m_marginBtnCancel.bottom; rectBtnCancelToMove.left = rectBtnCancelToMove.right - rectBtnCancel.Width(); rectBtnCancelToMove.top = rectBtnCancelToMove.bottom - rectBtnCancel.Height(); HDWP hdwp = ::BeginDeferWindowPos(2); if (hdwp) hdwp = DeferWindowPos(hdwp, m_btnOk.GetSafeHwnd(), HWND_TOP, rectBtnOkToMove.left, rectBtnOkToMove.top, rectBtnOkToMove.Width(), rectBtnOkToMove.Height(), SWP_NOZORDER); if (hdwp) DeferWindowPos(hdwp, m_btnCancel.GetSafeHwnd(), HWND_TOP, rectBtnCancelToMove.left, rectBtnCancelToMove.top, rectBtnCancelToMove.Width(), rectBtnCancelToMove.Height(), SWP_NOZORDER); if (hdwp) EndDeferWindowPos(hdwp); Invalidate(); UpdateWindow(); } CDialog::OnSize(nType, cx, cy); }
BOOL CTestClockDlg::OnInitDialog() { CDialog::OnInitDialog(); // 이 대화 상자의 아이콘을 설정합니다. 응용 프로그램의 주 창이 대화 상자가 아닐 경우에는 // 프레임워크가 이 작업을 자동으로 수행합니다. SetIcon(m_hIcon, TRUE); // 큰 아이콘을 설정합니다. SetIcon(m_hIcon, FALSE); // 작은 아이콘을 설정합니다. // TODO: 여기에 추가 초기화 작업을 추가합니다. // Get the margin information of the 'OK' and 'Cancel' button. CRect rectOrg; CRect rectOrgBtnOk; CRect rectOrgBtnCancel; GetClientRect(rectOrg); m_rectOrg = rectOrg; ClientToScreen(rectOrg); m_btnOk.GetWindowRect(rectOrgBtnOk); m_btnCancel.GetWindowRect(rectOrgBtnCancel); SetMargin(rectOrgBtnOk, rectOrg, m_marginBtnOk); SetMargin(rectOrgBtnCancel, rectOrg, m_marginBtnCancel); m_nBtnAreaHeight = m_marginBtnCancel.bottom * 2 + rectOrgBtnCancel.Height(); // Set the height of the button area SetRadius(rectOrg.Width(), rectOrg.Height()); m_nRadiusOrg = m_nRadius; SetCenterPoint(rectOrg.Width(), rectOrg.Height()); SetGradationPoints(); m_nHourGradSize = DEFAULT_HOUR_GRAD_SIZE; m_nMinuteGradSize = DEFAULT_MINUTE_GRAD_SIZE; m_nSecondHandSize = DEFAULT_SECOND_HAND_SIZE; m_nCenterPointSize = DEFAULT_CENTER_POINT_SIZE; m_timeCurrent = CTime::GetCurrentTime(); SetClockHandPoints(); m_bInit = TRUE; m_nTimerId = SetTimer(TIMER_ID, TIMER_INTERVAL, NULL); return TRUE; // 포커스를 컨트롤에 설정하지 않으면 TRUE를 반환합니다. }