各位大虾,请问如何动态向对话框上增加控件?比如增加一个picture控件,并设置其属性。

解决方案 »

  1.   

    CStatic static;
    static.Create(......);
    ModifyStyle(static.m_hWnd,ws_xxx,ws_xxx,0);
    .
    .
    .
      

  2.   

    add  control  variant ( m_cCtrl ) to you  application class  , then  you can  use like this:
        m_cCtrl.Create(.x,y....);
     the position  is  important  .you can use: GetClientRect(hMainWnd,&rc) or GetWindowRect(hMainWnd,&rc)  ;
      

  3.   

    CStatic* pStatic = new CStatic();
    pStatic->Create(NULL,SS_BITMAP|WS_VISIBLE,CRect(0,0,100,100),this);
    //CRect(0,0,100,100)为控件位置
    static CBitmap hbmp;
    hbmp.LoadBitmap(IDB_BITMAP);                         //装载位图
    pStatic->SetBitmap((HBITMAP)hbmp);
      

  4.   

    先定义一个类型指针,然后调用create就可以了。