对话框与视图结合的分割窗口.问题请教
分割式窗体,一边是视图,一边是对话框,中间的分隔条还可拖动 其中对话框是基于CFormView的代码如下:
void CLDLG::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
// TODO: Add your specialized code here and/or call the base class
HWND m_hWnd=GetSafeHwnd();
CRect rect;
::GetWindowRect(m_hWnd,rect);
ScreenToClient(rect);
m_nDlgWidth=rect.right-rect.left;
m_nDlgHeight=rect.bottom-rect.top;
m_nWidth=GetSystemMetrics(SM_CXSCREEN);
m_nHeigth=GetSystemMetrics(SM_CYSCREEN);
SetWindowPos(&wndTopMost,0,0,m_nWidth,m_nHeigth,SWP_SHOWWINDOW);
m_Multiple_width=float(m_nWidth)/float(m_nDlgWidth);
m_Multiple_heigth=float(m_nHeigth)/float(m_nDlgHeight);
change_flag=TRUE;//用来判定onsize执行之前观察oninitUpdate是否完成
//return TRUE;
}
void CLDLG::OnSize(UINT nType, int cx, int cy)
{
CFormView::OnSize(nType, cx, cy);
//CDialog::OnSize(nType, cx, cy);
// TODO: Add your message handler code here
if(change_flag)
{
ReSize(IDC_EDIT1);
ReSize(IDC_EDIT_DATA);
//ReSize(IDOK);
//ReSize(IDC_RADIO3);
m_Multiple_width=float(1)/m_Multiple_width;
m_Multiple_heigth=float(1)/m_Multiple_heigth;
}
}
void CLDLG::ReSize(UINT nID)
{
if(GetDlgItem(nID)==NULL)
return;
CRect Rect;
GetDlgItem(nID)->GetWindowRect(Rect);
ScreenToClient(Rect);
CPoint OldTLPoint,TLPoint;
OldTLPoint=Rect.TopLeft();
TLPoint.x=long(OldTLPoint.x*m_Multiple_width);
TLPoint.y=long(OldTLPoint.y*m_Multiple_heigth);
CPoint OldBRPoint,BRPoint;
OldBRPoint=Rect.BottomRight();
BRPoint.x=long(OldBRPoint.x*m_Multiple_width);
BRPoint.y=long(OldBRPoint.y*m_Multiple_heigth);
Rect.SetRect(TLPoint,BRPoint);
GetDlgItem(nID)->MoveWindow(Rect,TRUE);
}
为什么ReSize(IDC_EDIT1);的控件就不显示了,没有经过ReSize的还显示。
分隔条拖动时怎么样才能使视图那面的坐标系不变形?谢谢
--------------------编程问答-------------------- GetDlgItem(nID)->MoveWindow(Rect,TRUE);
移动后的位置有没超出窗口区域? --------------------编程问答-------------------- 标志位没有在构造函数内初始化,但是为什么变化只有两种方式,好像只认最大化和普通显示,不能随着变化而变化 --------------------编程问答--------------------
超出了
补充:.NET技术 , VC.NET