程序运行时得到了一幅图像的大小,然后需要把静态文本框设置为这幅图像的大小,如何设置静态文本框的大小?
希望设置的宽和高
long   m_nWidth;
long   m_nHeight;
m_VideoWnd 为静态文本框对应的变量

解决方案 »

  1.   

    m_VideoWnd.MoveWindow();
    void MoveWindow( int x, int y, int nWidth, int nHeight, BOOL bRepaint = TRUE );void MoveWindow( LPCRECT lpRect, BOOL bRepaint = TRUE );
      

  2.   

    MoveWindow()
    SetWindowPos()
      

  3.   

    CRect rect;
    m_VideoWnd.GetWindowRect(&rect);
    ScreenToClient (&rect);
    rect.bottom = rect.top + m_nHeight;
    rect.right = rect.left + m_nWidth;
    m_VideoWnd.MoveWindow( rect );
      

  4.   

    为什么调用了m_VideoWnd.MoveWindow( rect )后静态文本框就消失了
      

  5.   

    CRect rect;
    m_VideoWnd.GetWindowRect(&rect);ScreenToClient (&rect);//用了这句吗?前无m_VideoWnd.rect.bottom = rect.top + m_nHeight;
    rect.right = rect.left + m_nWidth;
    m_VideoWnd.MoveWindow( rect );
      

  6.   

    long   m_nWidth;
    long   m_nHeight;
    m_VideoWnd 为静态文本框对应的变量if(m_VideoWnd.GetSafeWnd())
    {
         MoveWindow(m_nWidth,m_nheight);
    }用加坐标转换吗?不用吧
      

  7.   

    用了ScreenToClient (&rect);就是按照你上面写的
      

  8.   

    使用上面的代码时你的m_nHeight与m_nWidth的值各是多少?不会是0吧?
      

  9.   

    是我得到的m_nHeight与m_nWidth的值有问题,谢谢hnyyy等
      

  10.   

    谢谢 hnyyy(前进) ( ) 信誉:111 受益。