I have created a customized class with inheriting CDockablepane in SDI application MFC. for ex. 

```
class CLoginPage :  public CDockablePane
{
    public:
    CLoginPage();
protected:
    CStatic lbl_username;
    CStatic lbl_password;
    CEdit txt_username;
    CEdit txt_password;
    CButton btn_login;
    CButton btn_Signup;
protected:
    afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
    afx_msg void OnSize(UINT nType, int cx, int cy);

    DECLARE_MESSAGE_MAP()
};

```

in .cpp I override oncreate function and onsize funtion

```
int CLoginPage::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    if (CDockablePane::OnCreate(lpCreateStruct) == -1)
        return -1;

    if(!lbl_username.Create(_T("User Name"), WS_CHILD | WS_VISIBLE, CRect(150, 150, 100, 30), this, ID_STATIC_USERNAME))
    {
        TRACE0("Failed to create userName in LoginPage window\n");
        return -1;
    }
 ......................................same for other control
}

void CLoginPage::OnSize(UINT nType, int cx, int cy)
{
    CDockablePane::OnSize(nType, cx, cy);

    // Tab control should cover the whole client area:
    CRect rectClient;
    this->GetWindowRect(rectClient);

    lbl_username.SetWindowPos (NULL, rectClient.left+150, rectClient.top+150, 100, 30, SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER);
.............................same for other control
}

```

when I run this it is displaying correctly as present in below image.

[![enter image description here](https://i.stack.imgur.com/pswE5.png)](https://i.stack.imgur.com/pswE5.png)

but after resize login window or move login window, it display very badly. please see below image

[![enter image description here](https://i.stack.imgur.com/dyYO9.png)](https://i.stack.imgur.com/dyYO9.png)

I don't know how to resolve this. Do I need to do something in WM\_PAINT message or something else. I tried a lot but i din't get any option.
Can someone please help me on this??