本人作了一个分割的单文档程序,左边为TreeView,右边上面和下面都是一个FormView,上面的FormView中放置了一个msflexgrid控件,我用以下的方法使它随CFormView的大小而变化,也就是充满整个View:
void CXXXXView::OnSize(UINT nType, int cx, int cy)
{
CFormView::OnSize(nType, cx, cy);
// TODO: Add your message handler code here
// Get safe handle
if(! AfxGetApp()->m_pMainWnd->GetSafeHwnd())
{
return;
} m_grid.SetWindowPos(this,0,0,cx,cy,false);
}
这样没问题,同样的处理我用在下面的FormView时却出了问题:
void CYYYView::OnSize(UINT nType, int cx, int cy)
{
CFormView::OnSize(nType, cx, cy);
// TODO: Add your message handler code here // Get safe handle
if(! AfxGetApp()->m_pMainWnd->GetSafeHwnd())
{
return;
}
RECT rect;
rect.top=cy;
rect.left=0;
rect.bottom=cy;
rect.right=cx;
m_edit.MoveWindow(&rect);//m_edit是一个RichEdit控件,我已经在App的InitInstance中加入了AfxInitRichEdit();一句
}我用调试模式编译时,程序指出m_edit.MoveWindow(&rect);这句发生了错误,错误提示是:
The thread 0x4E8 has exited with code 3 (0x3).
The program 'H:\PROG\VC\VIEW\WkSchedule\Debug\WkSchedule.exe' has exited with code 3 (0x3).请问大家这是什么原因,该怎么解决,谢谢。
void CXXXXView::OnSize(UINT nType, int cx, int cy)
{
CFormView::OnSize(nType, cx, cy);
// TODO: Add your message handler code here
// Get safe handle
if(! AfxGetApp()->m_pMainWnd->GetSafeHwnd())
{
return;
} m_grid.SetWindowPos(this,0,0,cx,cy,false);
}
这样没问题,同样的处理我用在下面的FormView时却出了问题:
void CYYYView::OnSize(UINT nType, int cx, int cy)
{
CFormView::OnSize(nType, cx, cy);
// TODO: Add your message handler code here // Get safe handle
if(! AfxGetApp()->m_pMainWnd->GetSafeHwnd())
{
return;
}
RECT rect;
rect.top=cy;
rect.left=0;
rect.bottom=cy;
rect.right=cx;
m_edit.MoveWindow(&rect);//m_edit是一个RichEdit控件,我已经在App的InitInstance中加入了AfxInitRichEdit();一句
}我用调试模式编译时,程序指出m_edit.MoveWindow(&rect);这句发生了错误,错误提示是:
The thread 0x4E8 has exited with code 3 (0x3).
The program 'H:\PROG\VC\VIEW\WkSchedule\Debug\WkSchedule.exe' has exited with code 3 (0x3).请问大家这是什么原因,该怎么解决,谢谢。
解决方案 »
- vc++MFC Win32
- 类型转换重载是怎样是实现的?
- 请问如何申请很大的数组空间但不会溢出呀?
- msdn 2005 和 msdn oct 2001兼容么?
- 想在窗口最小化和恢复正常大小 时分别做点事,应该怎么做?
- 怎么用VC++画图啊?
- m_list.SendMessage(WM_VSCROLL, MAKEWPARAM(SB_THUMBPOSITION, 20), NULL);怎么不好用?
- 哪位大侠有关于DDoS攻击机在攻击时的数据流量方面的资料?偶急需,先多谢了
- HTMl Help 一编译就提示“打开空文档失败”(在线给分)
- api高手请指教!
- 如何在工具栏编辑器中加入分隔符呀?谢谢?
- 怎样获得密码框内的字符串?
rect.top=cy;
rect.left=0;
rect.bottom=cy;
rect.right=cx;怎么top和bottom都等于cy,那还是矩形吗?
RECT rect;
rect.top=0;
rect.left=0;
rect.bottom=cy;
rect.right=cx;
m_edit.MoveWindow(&rect);
要不rebuild all试一试
if( m_edit.GetSafeHwnd() )
{
RECT rect;
rect.top=0;
rect.left=0;
rect.bottom=cy;
rect.right=cx;
m_edit.MoveWindow(&rect);
}试试
好用了,感谢。能说一下原因吗?