Visual Studio MFC dialog , Combo Box , Drop List

  • Thread starter Thread starter gsegria
  • Start date Start date
G

gsegria

Guest
I created a MFC dialog application in Visual Studio.

I used combo box and set drop list.

When i run app.exe , i can drop combo box.

When i press Maximize Box , i cannot drop combo box.

=======================

Here is my sample code:

BOOL CSampleDlg::OnInitDialog()

{

CRect rect;
GetWindowRect(&rect);
m_listChildWindowRect.AddTail(rect);
CWnd* pWnd = GetWindow(GW_CHILD);
while (pWnd)
{
pWnd->GetWindowRect(rect);
m_listChildWindowRect.AddTail(rect);
pWnd = pWnd->GetNextWindow();
}


}


void CSampleDlg::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);



if (m_ChildWindowRect.GetCount() > 0)
{
CRect Now;
GetWindowRect(&Now);

POSITION pos = m_ChildWindowRect.GetHeadPosition();
CRect Saved;
Saved = m_ChildWindowRect.GetNext(pos);

float x = Now.Width() * 1.0f / Saved.Width();
float y = Now.Height() * 1.0f / Saved.Height();

CRect child;
CWnd* pWnd = GetWindow(GW_CHILD);
while (pWnd)
{
child = m_ChildWindowRect.GetNext(pos);

child.left = (LONG)(Now.left + (child.left - Saved.left) * x);
child.right = (LONG)(Now.right + (child.right - Saved.right) * x);
child.top = (LONG)(Now.top + (child.top - Saved.top) * y);
child.bottom = (LONG)(Now.bottom + (child.bottom - Saved.bottom) * y);

ScreenToClient(child);
pWnd->MoveWindow(child);
pWnd = pWnd->GetNextWindow();

}
}
}


=======================


1600958.png


1600959.png


1600960.png

Continue reading...
 
Back
Top