在对话框上有Edit控件,如果对话框大小改变了,如何是Edit控件的大小也随之改变呢? 在对话框上有Edit控件,如果对话框大小改变了,如何是Edit控件的大小也随之改变呢?包括有CListCtrl控件 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 都一样。对话框改变大小时,每个控件都用MoveWindow函数重新定义大小和位置 OnSize里处理MoveWindow SetWindowPos都可以改变大小 响应WM_SIZE消息,添加下列代码(具体位置和大小你自己计算)CFormView::OnSize(nType, cx, cy);CRect rect;GetClientRect(&rect);int nWidth = rect.Width();int nLeight = rect.Height();if(m_edit.GetSafeHwnd()){ m_edit.SetWindowPos(this,rect.left + nWidth/100,rect.top + nLeight/100,nWidth-nWidth/100*2,nLeight/100*45,SWP_SHOWWINDOW|SWP_NOZORDER);}if(m_list.GetSafeHwnd()){ m_list.SetWindowPos(...)} 转帖的以前帖子代码:void COracleAssistView::OnSize(UINT nType, int cx, int cy) { CFormView::OnSize(nType, cx, cy); CRect rect; GetClientRect(&rect); int nWidth = rect.Width(); int nLeight = rect.Height(); if(m_edit.GetSafeHwnd()) { m_edit.SetWindowPos(this,rect.left + nWidth/100,rect.top +nLeight/100,nWidth-nWidth/100*2,nLeight/100*45,SWP_SHOWWINDOW|SWP_NOZORDER); } if(m_btnExec.GetSafeHwnd()) { m_btnExec.SetWindowPos(this,rect.left + nWidth/100*40,rect.top + nLeight/100*47,nWidth/15,nLeight/100*5 ,SWP_SHOWWINDOW|SWP_NOZORDER); } if(m_ctrList.GetSafeHwnd()) //m_ctrlList是listctrl的变量 { m_ctrList.SetWindowPos(this,rect.left + nWidth/100,rect.top + nLeight/100*58,nWidth-nWidth/100*2,nLeight/100*52,SWP_SHOWWINDOW|SWP_NOZORDER); } } laiyiling(最熟悉的陌生人) :) 我想创建一个静态链接库,里面调用其它的dll,要怎么做呢? 懂或者用过Packet32开发包的人请你帮帮我。 关于声卡设置问题~ 无模式对话框绘图 LISTBOX里面没有右键的消息吗? 求助, 第一个成功解答者给全部分. 巨简单问题, 高抬您贵手两分钟即可 dcom 在dot net平台中的位置/角色? CTreeCtrl控件左键弹消息不能响应响应问题 菜鸟提问:有关用vc读取.res文件数据的问题!急!!! 一个关于在局域网中传输文件的送分问题! 请教vb调用vc动态连接库问题——急!!!在线等 推荐一个国内优秀漏洞扫描工具,回复者有分
MoveWindow SetWindowPos都可以改变大小
CFormView::OnSize(nType, cx, cy);
CRect rect;
GetClientRect(&rect);
int nWidth = rect.Width();
int nLeight = rect.Height();
if(m_edit.GetSafeHwnd())
{ m_edit.SetWindowPos(this,rect.left + nWidth/100,rect.top + nLeight/100,nWidth-nWidth/100*2,nLeight/100*45,SWP_SHOWWINDOW|SWP_NOZORDER);
}if(m_list.GetSafeHwnd())
{
m_list.SetWindowPos(...)
}
{
CFormView::OnSize(nType, cx, cy); CRect rect;
GetClientRect(&rect);
int nWidth = rect.Width();
int nLeight = rect.Height();
if(m_edit.GetSafeHwnd())
{ m_edit.SetWindowPos(this,rect.left + nWidth/100,rect.top +nLeight/100,nWidth-nWidth/100*2,nLeight/100*45,SWP_SHOWWINDOW|SWP_NOZORDER);
} if(m_btnExec.GetSafeHwnd())
{
m_btnExec.SetWindowPos(this,rect.left + nWidth/100*40,
rect.top + nLeight/100*47,nWidth/15,nLeight/100*5 ,SWP_SHOWWINDOW|SWP_NOZORDER);
}
if(m_ctrList.GetSafeHwnd()) //m_ctrlList是listctrl的变量
{ m_ctrList.SetWindowPos(this,rect.left + nWidth/100,
rect.top + nLeight/100*58,nWidth-nWidth/100*2,nLeight/100*52,SWP_SHOWWINDOW|SWP_NOZORDER);
} }