没那么复杂,在 BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if( !CFrameWnd::PreCreateWindow(cs) ) return FALSE; // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs cs.dwExStyle &= ~WS_EX_CLIENTEDGE;// 加上 return TRUE; } 在 BOOL CGhView::PreCreateWindow(CREATESTRUCT& cs) { // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs cs.style &= ~WS_BORDER;//加上 return CFormView::PreCreateWindow(cs); }
{
cs.style &= ~WS_BORDER;
}
没有任何效果.
总之就是改style,dwExStyle.多试试。
我都试了一下午了,苦啊
重载CMainFrame:的OnWindowPosChanging()和OnWindowPosChanged如下:
void CMainFrame::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos)
{
CFrameWnd::OnWindowPosChanging(lpwndpos);
CView* pView = GetActiveView();
if(pView != NULL) {
RECT rcView;
GetClientRect(&rcView);
rcView.top = rcView.top - 2;
rcView.left = rcView.left - 2;
rcView.right = rcView.right + 2;
rcView.bottom = rcView.bottom + 2; //也可以用GetSystemMetrics(SM_CXEDGE); 代替常数2。
pView->MoveWindow(&rcView, TRUE);
}
}void CChildFrame::OnWindowPosChanged(WINDOWPOS FAR* lpwndpos) //和前面一样
{
CFrameWnd::OnWindowPosChanged(lpwndpos);
CView* pView = GetActiveView();
if(pView != NULL) {
RECT rcView;
GetClientRect(&rcView);
rcView.top = rcView.top - 2;
rcView.left = rcView.left - 2;
rcView.right = rcView.right + 2;
rcView.bottom = rcView.bottom + 2;
pView->MoveWindow(&rcView, TRUE);
}
}
之所以两个函数都要重载,是防止有些情况下border会露出来。
你试试:void CXxView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
GetParentFrame()->RecalcLayout();
ResizeParentToFit(); ModifyStyle(-1,WS_CHILD | WS_VISIBLE | WS_DLGFRAME);
ModifyStyleEx(-1,0);
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
cs.dwExStyle &= ~WS_EX_CLIENTEDGE;// 加上
return TRUE;
}
在
BOOL CGhView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
cs.style &= ~WS_BORDER;//加上 return CFormView::PreCreateWindow(cs);
}