【发布时间】:2019-03-18 08:28:43
【问题描述】:
我正在使用一个 CStatic 控件,其变量为“m_background”,ID 为 IDC_background。在此控件中,视频已在单击按钮时运行。还有第二个控件编辑控件,变量为“m_edit”,ID为IDC_edit。这个编辑框放置在静态控件上。我想在视频上显示编辑控件中编写的文本,同时我们通过单击具有编辑控件透明背景颜色的按钮播放视频。 但问题是在我们播放视频时,m_edit 控件出现了灰色/白色背景。我想在播放视频时以“m_edit”控件的透明背景在视频上显示文本。
BOOL CtestcodeDlg::OnInitDialog()//To set up the video in background and text above the video
{
m_background.ModifyStyle(0, WS_CLIPSIBLINGS);
m_edit.SetWindowPos(&CWnd::wndTop, 0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE|WS_EX_TRANSPARENT);
return TRUE; // return TRUE unless you set the focus to a control
}
HBRUSH CtestcodeDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) //To transparent the background of Edit box
{
HBRUSH hbr = CDialogEx::OnCtlColor(pDC, pWnd, nCtlColor);
HBRUSH m_default=CreateSolidBrush(RGB(0,0, 0));
if(pWnd->GetDlgCtrlID() == IDC_edit)
{
pDC->SetTextColor(RGB(255,0,0));
pDC->SetBkColor(TRANSPARENT);
pDC->SetBkMode(TRANSPARENT);
}
return hbr;
}
void CtestcodeDlg::OnBnClickedButton1()////To run the video
{
my_instance = libvlc_new(0, NULL);
my_media_file = libvlc_media_new_location(my_instance,
"rtsp://BigBuckBunny_115k.mov");
my_player = libvlc_media_player_new_from_media(my_media_file);
my_event_manager = libvlc_media_player_event_manager(my_player);
libvlc_media_player_play(my_player);
libvlc_audio_set_track(my_player ,-1);
libvlc_media_player_set_hwnd(my_player, m_background);
Sleep(1000);
_beginthread(test, 0, NULL);
libvlc_audio_set_track(my_player ,-1);
}
【问题讨论】:
标签: visual-c++ mfc