我是在对话框中实现的,CPicDlg为父对话框,dlg为无模式子对话框,OnNcLButtonDown需自己动手添加。
void CPicDlg::OnNcLButtonDown( UINT nHitTest, CPoint point )
{
CRect rect1,rect2;
dlg.GetWindowRect(&rect1);
this->GetWindowRect(&rect2);
xx=rect1.left-rect2.left-3;
yy=rect1.top-rect2.top-22;
CDialog::OnNcLButtonDown(nHitTest, point);
}void CPicDlg::OnMove(int x, int y) 
{
CDialog::OnMove(x, y);
int x1,y1;
if(ll==1)
{
x1=x+xx;
y1=y+yy;
dlg.SetWindowPos(&wndTop,x1,y1,0,0,SWP_NOSIZE);
}
}