mfc_circle_window - 8BitsCoding/RobotMentor GitHub Wiki
νλμ μμ λλκ·Ένμ¬ μ΄λκ°λ₯νκ² λ§λ€κΈ°
BOOL CMFCApplication1Dlg::OnInitDialog()
{
CDialogEx::OnInitDialog();
// μ΄ λν μμμ μμ΄μ½μ μ€μ ν©λλ€. μμ© νλ‘κ·Έλ¨μ μ£Ό μ°½μ΄ λν μμκ° μλ κ²½μ°μλ
// νλ μμν¬κ° μ΄ μμ
μ μλμΌλ‘ μνν©λλ€.
SetIcon(m_hIcon, TRUE); // ν° μμ΄μ½μ μ€μ ν©λλ€.
SetIcon(m_hIcon, FALSE); // μμ μμ΄μ½μ μ€μ ν©λλ€.
// TODO: μ¬κΈ°μ μΆκ° μ΄κΈ°ν μμ
μ μΆκ°ν©λλ€.
CRgn rgn;
rgn.CreateEllipticRgn(0,0,200,200);
SetWindowRgn(rgn, TRUE);
SetBackgroundColor(RGB(0, 200, 255));
return TRUE; // ν¬μ»€μ€λ₯Ό 컨νΈλ‘€μ μ€μ νμ§ μμΌλ©΄ TRUEλ₯Ό λ°νν©λλ€.
}
void CMFCApplication1Dlg::OnLButtonDown(UINT nFlags, CPoint point)
{
if (m_is_clicked == 0) {
m_is_clicked = 1;
GetCursorPos(&m_prev_pos);
// νλ©΄μ κΈ°μ€μΌλ‘ λ΄ λ§μ°μ€κ° μ΄λμλμ§ νμΈ
SetCapture();
}
CDialogEx::OnLButtonDown(nFlags, point);
}
void CMFCApplication1Dlg::OnMouseMove(UINT nFlags, CPoint point)
{
if (m_is_clicked == 1) {
CRect r;
GetWindowRect(r);
CPoint pos;
GetCursorPos(&pos);
SetWindowPos(NULL, r.left + pos.x - m_prev_pos.x, r.top + pos.y - m_prev_pos.y, 0, 0, SWP_NOSIZE);
m_prev_pos = pos;
}
CDialogEx::OnMouseMove(nFlags, point);
}
void CMFCApplication1Dlg::OnLButtonUp(UINT nFlags, CPoint point)
{
if (m_is_clicked == 1) {
m_is_clicked = 0;
ReleaseCapture();
}
CDialogEx::OnLButtonUp(nFlags, point);
}