Exemple #1
0
 /// <summary>
 /// Handler of Paint event of HostingControl.
 /// </summary>
 private void HostingControl_Paint
 (
     object sender,
     PaintEventArgs e
 )
 {
     if (_bGraphIsBuilt)
     {
         IntPtr hdc = e.Graphics.GetHdc();
         try
         {
             int hr = WindowlessCtrl.RepaintVideo(_DisplayPanel.Handle, hdc);
         }
         catch (System.Runtime.InteropServices.COMException ex)
         {
             // Catch com-expection VFW_E_BUFFER_NOTSET (0x8004020c) in RepaintVideo() and ignore it
             // it can be in the moment of moving window out of first monitor to second one.
             // NOTE: This could be probably fixed with checking if graph is running or not
             if (ex.ErrorCode != DsResults.E_BufferNotSet)
             {
                 throw;                                                      // re-throw exception up
             }
         }
         finally
         {
             e.Graphics.ReleaseHdc(hdc);
         }
     }
     return;
 }
        protected virtual bool Paint()
        {
            if (_MFVideoDisplayControl != null)
            {
                _MFVideoDisplayControl.RepaintVideo();
            }
            else
            {
                GDI.PAINTSTRUCT ps;
                IntPtr          hDC = GDI.BeginPaint(_hwnd, out ps);

                if (_VMRWindowlessControl != null)
                {
                    _VMRWindowlessControl.RepaintVideo(_hwnd, hDC);
                }
                else if (_VMRWindowlessControl9 != null)
                {
                    _VMRWindowlessControl9.RepaintVideo(_hwnd, hDC);
                }

                GDI.EndPaint(_hwnd, ref ps);
            }

            return(true);
        }
Exemple #3
0
 private void MainForm_Paint(object sender, PaintEventArgs e)
 {
     if (windowlessCtrl != null)
     {
         IntPtr hdc = e.Graphics.GetHdc();
         int    hr  = windowlessCtrl.RepaintVideo(this.Handle, hdc);
         e.Graphics.ReleaseHdc(hdc);
     }
 }
Exemple #4
0
        private void MainForm_Paint(object sender, PaintEventArgs e)
        {
            try
            {
                if (windowlessCtrl != null)
                {
                    FilterState fs;// wait for pause to complete
                    mediaControl.GetState(2000, out fs);

                    //   if (fs == FilterState.Running)
                    {
                        IntPtr hdc = e.Graphics.GetHdc();
                        int    hr  = windowlessCtrl.RepaintVideo(this.m_ParentPanel.Handle, hdc);
                        e.Graphics.ReleaseHdc(hdc);
                    }
                }
            }
            catch (Exception ex)
            {
                m_Log.Log("sourceVideoFile MainForm_Paint: ex: " + ex.Message, ErrorLog.LOG_TYPE.FATAL);
            }
        }