I wrote this code to draw a simple rectangle in a dialog , I also added ON_WM_PAINT() to my message map. but it didnt show anything on dialog to me ! I really appreciate it if anyone could tell my mistakes in code:
void Ctest4Dlg::OnPaint()
{
    if (IsIconic())
    {
        CPaintDC dc(this); // device context for painting
        // TODO: Add your message handler code here
        SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
        // Center icon in client rectangle
        int cxIcon = GetSystemMetrics(SM_CXICON);
        int cyIcon = GetSystemMetrics(SM_CYICON);
        CRect rect;
        GetClientRect(&rect);
        int x = 2;
        int y = 2;
        // Draw the icon
        dc.DrawIcon(x, y, m_hIcon);
        //I want to draw a rectangle 
        dc.Rectangle(10,10,50,50);
    }
    else
    {
        CDialogEx::OnPaint();
    }
}