请问如何使对话框大小自动随控件大小的改变而改变

FW04 2005-12-19 11:55:17
我在对话框中插入AactiveMovie控件,播放后,影片画面总是盖住了滑动条,请问如何使对话框大小自动随控件大小的改变而改变? 谢谢
...全文
155 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
FW04 2006-01-12
  • 打赏
  • 举报
回复
谢谢.
xwmpq 2005-12-21
  • 打赏
  • 举报
回复
void CUserInfoDlg::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);

ChangeChildWndSize(thisRect);
}

void CUserInfoDlg::ChangeChildWndSize(CRect &OwnerRect)
{

CWnd *pWndFirst=GetWindow(GW_CHILD);
CWnd *pWndNext=pWndFirst;
CRect NOSize=NULL;
this->GetClientRect(NOSize);
float comparx=(float)NOSize.right/OwnerRect.right;//Get the Comparison of the new Onwer
float compary=(float)NOSize.bottom/OwnerRect.bottom;//Window and the Old window
TRACE("NOSize.right return value is %d\r\n",NOSize.right);
TRACE("OwnerRect.right return value is %d\r\n",OwnerRect.right);
if(OwnerRect.Width()!=0)//如果费第一次调用
{

while(pWndNext!=NULL)
{
CRect NChSize=NULL;
pWndNext->GetWindowRect(NChSize);
pWndNext->GetParent()->ScreenToClient(NChSize);

NChSize.bottom=(long)(NChSize.bottom*compary);


NChSize.left=(long)(NChSize.left*comparx);
NChSize.top=(long)(NChSize.top*compary);
NChSize.right=(long)(NChSize.right*comparx);
pWndNext->SetWindowPos( &wndTopMost,
NChSize.left,
NChSize.top,
NChSize.Width(),
NChSize.Height(),
SWP_NOZORDER);


Invalidate(true);
pWndNext=pWndNext->GetWindow(GW_HWNDNEXT);
}
}
OwnerRect=NOSize;
}
偶的一段代码

OnInitDialog里头加上
this->GetClientRect(thisRect);
.h里头加
//窗体调整
void ChangeChildWndSize(CRect&OwnerRect);
CRect thisRect;
wotur 2005-12-21
  • 打赏
  • 举报
回复
http://bbs.zndev.com/htm_data/90/0511/103104.html
这有个例子和你的是反的你下载(要注册,下后面一个链接)了后,看懂了改一下就可以了
我是借花献佛!
duyhui 2005-12-20
  • 打赏
  • 举报
回复
应该可以调整ActiveMovie控件的大小
laofang 2005-12-20
  • 打赏
  • 举报
回复
1。首先你要计算出控件大小

2。然后用动态改变对话框大小,同时要调整其中一些控件位置,都可用SetWindowPos
GetParent()->SetWindowPos
GetDlgItem(IDC_xxx)->SetWindowPos
FW04 2005-12-19
  • 打赏
  • 举报
回复
晕,

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧