------------------------------------------------------------------------------------------
|父窗口移动子窗口也跟着移动|
------------------------------------------------------------------------------------------
//设置子对话框属性
Border Dialog Frame
Style Popup
Title Bar
.h文件中。。。。
CInternalTipDlg *internaltip;
.CPP
void CCheckBillingRecordsCurrentInputDlg::OnBnClickedBtnInsidepointCi()
{
// 弹出内部提示对话框
if(internaltip == NULL){//这句是防止非模式对话框弹出多个,但是一定要在构造函数中初始化(internaltip == NULL;
internaltip = new CInternalTipDlg;
CRect rs;
GetDlgItem(IDC_BTN_INSIDEPOINT_CI)->GetWindowRect(rs);//ID是子窗口
internaltip->Create(IDD_DIALOG_INTERNALTIP_IT,this);
internaltip->ShowWindow(TRUE);
internaltip->SetWindowPos(&wndTopMost ,(rs.left-50 + rs.right)/2,rs.bottom ,0,0,SWP_NOSIZE);//设置移动位置,第一个参数说明显示最前
internaltip->UpdateWindow();//显示更新
}
}
//这个是WM_MOVE
void CCheckBillingRecordsCurrentInputDlg::OnMove(int x, int y)
{
CDialog::OnMove(x, y);
//你窗口移动时,子窗口跟着移动
::SetWindowPos(internaltip->GetSafeHwnd(),NULL,x + 600,y + 60,0,0,SWP_NOSIZE);
}
后语:一定要在CCheckBillingRecordsCurrentInputDlg类中初始化构造函数时初始化
internaltip = NULL;
形式如下
CReplacementOrderDlg::CReplacementOrderDlg(CWnd* pParent /*=NULL*/)
: CDialog(CReplacementOrderDlg::IDD, pParent)
{
internaltipone = NULL;
}
------------------------------------------------------------------------------------------
|父窗口移动子窗口也跟着移动|
------------------------------------------------------------------------------------------
//设置子对话框属性
Border Dialog Frame
Style Popup
Title Bar
.h文件中。。。。
CInternalTipDlg *internaltip;
.CPP
void CCheckBillingRecordsCurrentInputDlg::OnBnClickedBtnInsidepointCi()
{
// 弹出内部提示对话框
if(internaltip == NULL){//这句是防止非模式对话框弹出多个,但是一定要在构造函数中初始化(internaltip == NULL;
internaltip = new CInternalTipDlg;
CRect rs;
GetDlgItem(IDC_BTN_INSIDEPOINT_CI)->GetWindowRect(rs);//ID是子窗口
internaltip->Create(IDD_DIALOG_INTERNALTIP_IT,this);
internaltip->ShowWindow(TRUE);
internaltip->SetWindowPos(&wndTopMost ,(rs.left-50 + rs.right)/2,rs.bottom ,0,0,SWP_NOSIZE);//设置移动位置,第一个参数说明显示最前
internaltip->UpdateWindow();//显示更新
}
}
//这个是WM_MOVE
void CCheckBillingRecordsCurrentInputDlg::OnMove(int x, int y)
{
CDialog::OnMove(x, y);
//你窗口移动时,子窗口跟着移动
::SetWindowPos(internaltip->GetSafeHwnd(),NULL,x + 600,y + 60,0,0,SWP_NOSIZE);
}
后语:一定要在CCheckBillingRecordsCurrentInputDlg类中初始化构造函数时初始化
internaltip = NULL;
形式如下
CReplacementOrderDlg::CReplacementOrderDlg(CWnd* pParent /*=NULL*/)
: CDialog(CReplacementOrderDlg::IDD, pParent)
{
internaltipone = NULL;
}
------------------------------------------------------------------------------------------