同题

解决方案 »

  1.   

    描述的太不清楚了.猜想了一下,会不会跟你添加的位置有关,矩形区域rect没有调用ScreenToClient(&rect)函数?
      

  2.   

    CRect rect;
    GetWindowRect(rect);
    CWnd* pParent = GetParent();
    if (pParent != NULL)
    pParent->ScreenToClient(rect);
    rect.InflateRect(1,1); MoveWindow(rect);
    rect.DeflateRect(1,1);  MoveWindow(rect);
      rect.left = 100;
    rect.top = 110;
    rect.right = 200;
    rect.bottom = 115;
    m_pSheet.m_scrollBarV.Create(SBS_HORZ | SBS_TOPALIGN | WS_CHILD | WS_VISIBLE,rect,this,100);
    m_button.Create("要在按钮上显示的文字", WS_CHILD|WS_VISIBLE|WS_BORDER, CRect(10,10,100,30), this, 3456);