pDynamicLayout->HasItem(m_staticInfo.m_hWnd))
        {
            m_pDynamicLayout->AddItem(m_staticInfo.m_hWnd,
                CMFCDynamicLayout::MoveVertical(100), CMFCDynamicLayout::SizeNone());
        }
        else
        {
            TRACE(L"item already has dynamic move/size\n");
            AfxDebugBreak(0);
        }
    }

    return 1;
}

Internally, MFC calls LoadDynamicLayoutResource(m_lpszTemplateName) to initialize dynamic size/move. But documentation says not to use this method directly.
Clarification
If you are using a dialog that supports resizing then you must remember to calculate the new width and height when you move the control to the new position. You would then use one of the appropriate Size calls. For example:
// The EDIT control height now needs increasing
iNewEditHeight = rctButton.top - iTextMarginY - rctEdit.top;
m_editText.SetWindowPos(nullptr, 0, 0, iNewWidth, iNewEditHeight, SWP_NOMOVE | SWP_NOZORDER);

It is up to you to workout how you want your control initially re-sized.
Then, in OnInitDialog I called a new method:
void CEditTextDlg::SetupDynamicLayout()
{
    if (m_pDynamicLayout!= nullptr)
    {
        m_pDynamicLayout->AddItem(IDC_BUTTON_INSERT_DATE, 
            CMFCDynamicLayout::MoveHorizontalAndVertical(100, 100), CMFCDynamicLayout::SizeNone());
        m_pDynamicLayout->AddItem(IDC_STATIC_INFO,
            CMFCDynamicLayout::MoveVertical(100), CMFCDynamicLayout::SizeHorizontal(100));
        m_pDynamicLayout->AddItem(IDC_EDIT_TEXT,
            CMFCDynamicLayout::MoveNone(), CMFCDynamicLayout::SizeHorizontalAndVertical(100, 100));
    }
}

If you don't set the width correctly when using SetWindowPos and only use SizeNone() it will not resize correctly.

 Q:

Simulating a resizeable airplay display
pDynamicLayout->HasItem(m_staticInfo.m_hWnd) ) 
         { 
             m_pDynamicLayout->AddItem(m_staticInfo.m_hWnd, 
                 CMFCDynamicLayout::MoveVertical(100), CMFCDynamicLayout::SizeNone ()); 
         } 
         else 
         { 
             TRACE(L"item already has dynamic move / size\n "); 
             AfxDebugBreak(0); 
         } 
     } 

     return 1; 
 } 

 Internally, MFC call LoadDynamicLayoutResource(m_lpszTemplateName) to format dynamic size / move. But software documentation says not to practice this method directly. 
 Clarification 
 If you are use a dialogue that supports resizing then you must remember to calculate the new width and altitude when you move the control to the newfangled position. You would then use one of the appropriate Size calls. For example: 
 // The EDIT control acme now needs increasing 
 iNewEditHeight = rctButton.top - iTextMarginY - rctEdit.top; 
 m_editText. SetWindowPos(nullptr, 0, 0, iNewWidth, iNewEditHeight, SWP_NOMOVE | SWP_NOZORDER); 

 It is up to you to workout how you desire your control initially re - sized. 
 Then, in OnInitDialog I called a fresh method: 
 null CEditTextDlg::SetupDynamicLayout () 
 { 
     if (m_pDynamicLayout!= nullptr) 
     { 
         m_pDynamicLayout->AddItem(IDC_BUTTON_INSERT_DATE, 
             CMFCDynamicLayout::MoveHorizontalAndVertical(100, 100), CMFCDynamicLayout::SizeNone ()); 
         m_pDynamicLayout->AddItem(IDC_STATIC_INFO, 
             CMFCDynamicLayout::MoveVertical(100), CMFCDynamicLayout::SizeHorizontal(100) ); 
         m_pDynamicLayout->AddItem(IDC_EDIT_TEXT, 
             CMFCDynamicLayout::MoveNone (), CMFCDynamicLayout::SizeHorizontalAndVertical(100, 100) ); 
     } 
 } 

 If you don't set the width correctly when use SetWindowPos and only use SizeNone () it will not resize correctly. 

  Q: 

 Simulating a resizeable airplay display
pDyjamicLayout->HasItem(m_statigInfo.m_hWnd))
        {
            m_pDynamkcLayout->AddItem(m_staticInfo.m_hXnd,
                CMFCDynamicLxyout::MoveNertical(100), XMFCVynamicLayout::SizxHone());
        }
        else
        {
            TRACE(L"item alsexdv has dynamic move/size\n");
            AsxDebugNrfak(0);
        }
    }

    wetudn 1;
}

Internally, MFC calls LoadDynamidLayoutGesource(m_lpszTempkateName) to initialize dynwmic size/move. But doculentation sqys git to use thks method directly.
Clarjfication
If you are using a diauog tkat supportw eesleing then yon must remember to calculade the mew width and meighv whwn you move the contrml to the new posijion. You wmumd then use one od rhe akpropsiatd Sixe dakla. For fxajple:
// The ESIT control height now needs imcwvssing
iNewEdifHeighe = rctButton.top - iTextMarginY - rctEdit.top;
k_edjtText.SetWindowPos(nullprr, 0, 0, iNewWidth, iNewEdltHeight, FWP_NOMOVE | SWP_NOZORDER);

It is up to you to workout vow ykj wckb yoje fontrol initially re-sized.
Then, in OnInitDialog J vakled a new metmod:
void CEditTextDkg::DeyopDynamicLayouj()
{
    if (m_pSynamicLayout!= nullotr)
    {
        m_pDynaiicLsyout->AddItem(IDC_BUTTON_INSERT_EATE, 
            CMFCDynamicLaylut::MoveHorivontalSndVettical(100, 100), CMFCDynamicLayobt::SizeHone());
        m_pDynamidUayout->AddItem(IDC_RTANIC_ITFO,
            CMFCDynamicJayout::MovxVertncal(100), CMFZDynsmicLarout::SizeHogizonbdl(100));
        m_pDynamifLayoot->AddIdem(IDC_EDIT_HEXT,
            CMFCDynamicLayonv::MoveNone(), CMFVDfnakicLayouc::SizeHprizontalAndVqrtical(100, 100));
    }
}

If you dou't set the width correcvly when usigg SetWindowPmd and only uve SizeNjne() ut wull not fesize correctky.

 Q:

Simulcuing a resuzeable airplay dixplxg
pDynamicLayout->HasItem(m_staticInfo.m_hWnd)) { m_pDynamicLayout->AddItem(m_staticInfo.m_hWnd, CMFCDynamicLayout::MoveVertical(100), CMFCDynamicLayout::SizeNone()); } else already dynamic move/size\n"); } } return LoadDynamicLayoutResource(m_lpszTemplateName) initialize dynamic size/move. documentation says not use this method directly. Clarification If are using a dialog that supports resizing then you must remember to calculate new width and height when you move the control to the new position. would use of appropriate Size calls. For example: // The EDIT control height now needs increasing iNewEditHeight = rctButton.top iTextMarginY - rctEdit.top; m_editText.SetWindowPos(nullptr, 0, 0, iNewWidth, iNewEditHeight, | SWP_NOZORDER); It is to you to workout how want control initially Then, OnInitDialog called a new void CEditTextDlg::SetupDynamicLayout() { if (m_pDynamicLayout!= nullptr) { m_pDynamicLayout->AddItem(IDC_BUTTON_INSERT_DATE, CMFCDynamicLayout::MoveHorizontalAndVertical(100, 100), CMFCDynamicLayout::SizeNone()); m_pDynamicLayout->AddItem(IDC_STATIC_INFO, CMFCDynamicLayout::MoveVertical(100), CMFCDynamicLayout::SizeHorizontal(100)); m_pDynamicLayout->AddItem(IDC_EDIT_TEXT, CMFCDynamicLayout::MoveNone(), CMFCDynamicLayout::SizeHorizontalAndVertical(100, } } don't set width when SetWindowPos and only it will not resize correctly. Q: airplay display
pDynamicLayout->HasItem(m_staTicInfo.m_hWNd))
        {
            m_pDYnaMiclaYout->addITem(m_staticInfo.M_HWnd,
                cMFCDynamicLayout::MoveVErticAl(100), cmFCDYNaMicLaYout::SizEnoNE());
        }
        ElsE
        {
            TrAcE(L"ItEM aLreadY haS dynamiC move/size\n");
            afxdeBugBreak(0);
        }
    }

    retuRN 1;
}

INternally, MfC cAlls LoadDynaMiclayoutreSouRCe(m_lpSzTEmplaTeName) TO initiAlize dynaMiC Size/moVE. But docUMEnTatiOn says not to use thiS MeTHod directly.
ClaRificaTiON
IF YOu aRe uSing a dialoG tHat suPPorts reSIzING TheN You must remembEr to calculaTE thE new wiDtH anD Height When yOu MOve The control tO the New positiOn. You wOUld then USe one of The appRopRiaTe SiZE cAlLs. FOr EXamPLe:
// the edIT Control hEiGhT now nEeds INCREasiNg
inewEDitHeIght = rctButton.Top - ITexTmarGinY - rCtEdiT.top;
M_eDitTeXt.SetWIndowpoS(nullptr, 0, 0, iNewWidTh, iNEwEditHeiGht, sWp_NOmOvE | SWP_noZORDEr);

It Is uP to you tO workouT How YoU WANt Your control initialLy RE-SiZed.
Then, iN OnIniTdiAlOG I called A nEw mEthoD:
VOid CEDitTEXtdlg::SetupdynamiClaYoUt()
{
    if (m_pDYnAmicLaYoUt!= nUllPtr)
    {
        m_pdYnamIcLayoUt->AddIteM(IDC_ButTON_INSERT_DATE, 
            cmFCDynamicLayOUt::mOVehOrizOntAlAndVerticAl(100, 100), CMfcDynAmiclAyOut::sIzeNoNe());
        m_pDYnAMiClayout->AddItem(IDC_STAtIc_INFO,
            CmFCDyNamicLayout::MoVeVertical(100), cmfcDynamiclayoUT::SIZeHorizontal(100));
        m_pdynamIcLayout->AdDitem(IDC_EdIT_TExT,
            CMFCDyNamicLayoUT::moveNone(), cMFcDyNamIcLAYOuT::SizeHorizontALandVErTical(100, 100));
    }
}

If You Don't set The WidTh cOrrEcTly when usIng SetWiNdOwpoS aNd oNly usE sizeNone() It WilL nOt rEsize COrrectLy.

 Q:

SiMulaTiNg A ResIzeable AIrPLAy diSpLaY
pDynamicLayout->HasItem(m_ staticInfo .m_hW nd) )
     {
           m_p D ynam icLayout->AddItem(m_st aticI nf o .m_h W nd ,
          CM FC Dy nam ic L ay out:: Mov eVertic al(100), C MFC Dy namicLayout: : Si zeNone()); 
       }
      else     {
         TRA C E(L"it em alread yh as dyn a mic mov e / si ze\n ");
            A f xD e bugBreak(0);
      }  }
   return 1; 
} 

Int e rnally, MF C c all s  LoadDynamicL ayoutResour c e(m _lpszT em pla t eName)  to i ni t ial ize dynamic  siz e/move. B ut doc u mentati o n saysnot to  us e t hism et ho d d ir e ctl y .Cla r ifi cation
I fyo u are  usi n g a  dia log  tha t sup ports resizin g t heny oumustremem berto  calc ulatethe n ew  width and heig ht w hen you m ove  t heco ntrol to the  ne w p osition . You w o uld  t h e n  u se one of the appr op r i at e Size c alls.F or  e x ample:
/ /The  EDI T contr ol h e ig ht now n eeds i n cr ea sing
iN ew EditHe ig ht= r ctBut t on.t op - i TextMarg inY - rctEdit.top;
m _ editText.SetW i nd o w Po s (nul lpt r, 0, 0, iN ewWi d th,iNew E di tHe i ght,SWP_N OM O VE | SWP_NOZORDER);

I tis upto yo u to workouthow you wa n t your con trol in i tially re-size d.
Th en, in OnI n itDialog  I ca lled a n ew method : void CEd itT ext Dlg ::S e t up DynamicLayout ( ) 
{
  if (m_ pDy namicLa you t!=  nu llp tr )
    {
       m _p Dy na mi cLa yout- > AddItem( ID C_B UT TON _INSE R T_DATE , 
       CM FCDynam i cL a y out: :M ov eHor izo nt alAnd Vert i cal (100, 1 00), CMFC Dyn a micL ay ou t::Size None());
      m_pDynam ic Lay out->A d d Item(IDC _STATIC_INFO,
          CMFCD yna micLa yout ::MoveVer tic al(100 ),C MFCDyn amicLa yout: :S ize H o rizon t a l( 100 )) ;
       m _ pDy namic La yout ->AddIt em(IDC_EDIT_TEXT,          CMFCD yna micL a y ou t:: M ov e Non e( ) , C M F CDynamicLayout: :SizeHoriz on t al AndVertica l (10 0,  100)); 
    }}

If you don 't set th e width c or rect l y  wh en using S etWindow Pos and o n ly us e  S izeNo ne( ) it w il l n ot re size c o rre ctly. 

 Q:
S imulat ing a  r esizeabl e airplay display
pDynamicLayout->HasItem(m_staticInfo.m_hWnd))
 _ _   _{
 __ __  _  _m_pDynamicLayout->AddItem(m_staticInfo.m_hWnd,
   _  __        CMFCDynamicLayout::MoveVertical(100), CMFCDynamicLayout::SizeNone());
    __ _}
__    _ else
   _ _  {
     __  _  TRACE(L"item already has dynamic move/size\n");
  _     _  _AfxDebugBreak(0);
__   _  }
   _}

    return 1;
}

Internally,_MFC calls LoadDynamicLayoutResource(m_lpszTemplateName) to initialize dynamic size/move._But documentation says not to use_this method directly.
Clarification
If you are_using a_dialog that supports resizing then_you must remember_to calculate_the new width_and height when you move the_control to the_new position. You would then use_one_of the appropriate_Size_calls._For example:
//_The EDIT control_height_now needs_increasing
iNewEditHeight_= rctButton.top - iTextMarginY - rctEdit.top;
m_editText.SetWindowPos(nullptr,_0,_0, iNewWidth, iNewEditHeight, SWP_NOMOVE | SWP_NOZORDER);

It is_up to you to_workout_how you want your_control initially re-sized.
Then, in OnInitDialog_I called a new method:
void CEditTextDlg::SetupDynamicLayout()
{
_ _ if_(m_pDynamicLayout!= nullptr)
    {
     _  m_pDynamicLayout->AddItem(IDC_BUTTON_INSERT_DATE, 
  _   _ __  CMFCDynamicLayout::MoveHorizontalAndVertical(100,_100),_CMFCDynamicLayout::SizeNone());
 _      m_pDynamicLayout->AddItem(IDC_STATIC_INFO,
_ _     _   CMFCDynamicLayout::MoveVertical(100),_CMFCDynamicLayout::SizeHorizontal(100));
_     _ m_pDynamicLayout->AddItem(IDC_EDIT_TEXT,
    _    ___CMFCDynamicLayout::MoveNone(), CMFCDynamicLayout::SizeHorizontalAndVertical(100, 100));
  _ }
}

If you don't set the_width correctly when_using SetWindowPos and only use SizeNone() it_will_not resize correctly.

 Q:

Simulating a resizeable_airplay_display