Windows Media Player

ywolf0214 2008-07-31 02:04:40
请问各位大虾如何使windows media player控件随着窗口大小而自动重绘?我尝试获取它的大小然后movewindow,但是这样不成功。希望能给出源代码,谢谢!
...全文
135 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
songsu 2008-08-06
  • 打赏
  • 举报
回复
响应 OnSize事件后,在里面操作。
jiazhuoyang 2008-08-06
  • 打赏
  • 举报
回复
http://www.skinfeature.com
ywolf0214 2008-08-01
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 zgl7903 的回复:]
使用 SetWindowPos 函数就可以

void CDD2Dlg::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);

// TODO: Add your message handler code here
if(m_MMPlayer.GetSafeHwnd())
{
m_MMPlayer.SetWindowPos(&wndTop,0,0,cx,cy, SWP_NOZORDER);
}
}
[/Quote]
这样可以吗?我的控件也不是充满在整个Dialog里面啊
zgl7903 2008-08-01
  • 打赏
  • 举报
回复
使用 SetWindowPos 函数就可以

void CDD2Dlg::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);

// TODO: Add your message handler code here
if(m_MMPlayer.GetSafeHwnd())
{
m_MMPlayer.SetWindowPos(&wndTop,0,0,cx,cy, SWP_NOZORDER);
}
}
wujiangzhao2007 2008-08-01
  • 打赏
  • 举报
回复
虽然不知道,但是还是顶一下……
ywolf0214 2008-07-31
  • 打赏
  • 举报
回复
借鉴了别人的做法,他是在OnSize里面这么处理的:
void CRecordHWndDlg::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);


/////////////////listRect:CListRect listRect;
////////////////对话框初始化时做了下面操作:
////////CRect rectWnd; //此段代码的作用是记录窗口初始时的矩阵,便于用于缩放窗口
////////GetWindowRect(&rectWnd);
////////listRect.AddTail(&rectWnd);
////////CWnd *pWndChild = GetWindow(GW_CHILD);
////////while(pWndChild)
////////{
////////pWndChild->GetWindowRect(&rectWnd);
////////listRect.AddTail(&rectWnd);
////////pWndChild = pWndChild->GetNextWindow();
////////}
////////////////////////
int nCount=listRect.GetCount();
if(nCount > 0)
{
//m_VedioPlayer.GetWindowRect(&wmpRect);
CRect rectDlgNow;
GetWindowRect(&rectDlgNow);
POSITION mP = listRect.GetHeadPosition();
CRect rectDlgSaved;
rectDlgSaved = listRect.GetNext(mP);
ScreenToClient(rectDlgSaved);
ScreenToClient(rectDlgNow);
float fRateScaleX = (float)(rectDlgNow.right-rectDlgNow.left)/(rectDlgSaved.right-rectDlgSaved.left);
float fRateScaleY = (float)(rectDlgNow.bottom-rectDlgNow.top)/(rectDlgSaved.bottom-rectDlgSaved.top);
ClientToScreen(rectDlgSaved);
ClientToScreen(rectDlgNow);
LOGFONT stFont;
::GetObject((HFONT)GetStockObject(DEFAULT_GUI_FONT), sizeof(stFont), &stFont);
strcpy(stFont.lfFaceName,"Times New Roman");
stFont.lfHeight = (long)(fRateScaleY*14);
stFont.lfWidth = (long)(fRateScaleX*7);
CFont * m_pCFont;
m_pCFont = new CFont;
m_pCFont->CreateFontIndirect(&stFont);
CRect rectChildSaved;
CWnd *pWndChild = GetWindow(GW_CHILD);
while(pWndChild)
{
rectChildSaved = listRect.GetNext(mP);
rectChildSaved.left = rectDlgNow.left+(int)((rectChildSaved.left-rectDlgSaved.left)* fRateScaleX);
rectChildSaved.top = rectDlgNow.top+(int)((rectChildSaved.top-rectDlgSaved.top)*fRateScaleY);
rectChildSaved.right = rectDlgNow.right+(int)((rectChildSaved.right-rectDlgSaved.right)* fRateScaleX);
rectChildSaved.bottom = rectDlgNow.bottom+(int)((rectChildSaved.bottom-rectDlgSaved.bottom)* fRateScaleY);
ScreenToClient(rectChildSaved);
pWndChild->MoveWindow(rectChildSaved);
pWndChild->SetFont(m_pCFont);
pWndChild = pWndChild->GetNextWindow();
}
}
Invalidate();
}
但是这么做只能让按钮等控件动态改变,却不能使window media player动态改变,不知道为什么。
ywolf0214 2008-07-31
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 zzz3265 的回复:]
引用楼主 ywolf0214 的帖子:
但是这样不成功。

你想要什么样子? 怎么才算OK
你现在是什么问题?
[/Quote]
我现在在OnSize事件里能够处理其他控件例如按钮和文本框控件的大小改变,但是没有办法去动态改变windows media player的大小。
ywolf0214 2008-07-31
  • 打赏
  • 举报
回复
简单的说,就是一个对话框上放了一个windows media player控件,如何让它随着对话框大小改变而改变。
Yofoo 2008-07-31
  • 打赏
  • 举报
回复
[Quote=引用楼主 ywolf0214 的帖子:]
但是这样不成功。[/Quote]

你想要什么样子? 怎么才算OK
你现在是什么问题?
ywolf0214 2008-07-31
  • 打赏
  • 举报
回复
顶~~~没人知道么?

15,979

社区成员

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

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