SetLocation
C#
public void SetLocation(int lLeft, int lTop, int lWidth, int lHeight);
VB.NET
Public Sub SetLocation(lLeft As Integer, lTop As Integer, lWidth As Integer, lHeight As Integer)
C++/Qt
void SetLocation (int lLeft, int lTop, int lWidth, int lHeight);
Sets the location of the video window within the parent control. Not available in Delphi and C++Builder, where the component resizes automatically when the parent control is resized.
E.g.:
CMFCFormDlg::CMFCFormDlg(CWnd* pParent /*=nullptr*/)
: CDialogEx(IDD_MFCFORM_DIALOG, pParent)
, m_VideoGrabber(NULL)
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
m_VideoGrabber = new CVideoGrabber(this);
}
CMFCFormDlg::~CMFCFormDlg()
{
delete m_VideoGrabber;
}
BOOL CMFCFormDlg::OnInitDialog()
{
CDialogEx::OnInitDialog();
m_VideoGrabber->SetParentWindow(this->GetSafeHwnd());
...
return TRUE; // return TRUE unless you set the focus to a control
}
void CMFCFormDlg::OnSize(UINT nType, int w, int h)
{
m_VideoGrabber->SetLocation(0, 0, w, h);
}
void CMFCFormDlg::OnBnClickedOk()
{
m_VideoGrabber->SetVideoSource(TVideoSource::vs_ScreenRecording);
m_VideoGrabber->StartPreview();
}