当前位置: 首页>>代码示例>>C#>>正文


C# IVideoWindow.SetWindowPosition方法代码示例

本文整理汇总了C#中IVideoWindow.SetWindowPosition方法的典型用法代码示例。如果您正苦于以下问题:C# IVideoWindow.SetWindowPosition方法的具体用法?C# IVideoWindow.SetWindowPosition怎么用?C# IVideoWindow.SetWindowPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IVideoWindow的用法示例。


在下文中一共展示了IVideoWindow.SetWindowPosition方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ShowMedia

        /// <summary>
        /// Plays the given mediafile in the internal mediaplayer
        /// </summary>
        /// <param name="FilePath">File to play</param>
        public void ShowMedia(string FilePath)
        {
            StopMedia();
            Lbl_CurrentMedia.Text = Path.GetFileName(FilePath);
            m_objFilterGraph = new FilgraphManager();
            m_objFilterGraph.RenderFile(FilePath);

            m_objBasicAudio = m_objFilterGraph as IBasicAudio;

            try
            {
                m_objVideoWindow = m_objFilterGraph as IVideoWindow;
                m_objVideoWindow.Owner = (int)panel2.Handle;
                //m_objVideoWindow.Owner = (int)panel1.Handle;

                m_objVideoWindow.WindowStyle = WS_CHILD | WS_CLIPCHILDREN;
                m_objVideoWindow.SetWindowPosition(panel2.ClientRectangle.Left,
                   panel2.ClientRectangle.Top,
                    panel2.ClientRectangle.Width,
                    panel2.ClientRectangle.Height);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                m_objVideoWindow = null;
            }

            m_objMediaEvent = m_objFilterGraph as IMediaEvent;

            m_objMediaEventEx = m_objFilterGraph as IMediaEventEx;
            m_objMediaEventEx.SetNotifyWindow((int)this.Handle, WM_GRAPHNOTIFY, 0);

            m_objMediaPosition = m_objFilterGraph as IMediaPosition;

            m_objMediaControl = m_objFilterGraph as IMediaControl;

            m_objMediaControl.Run();
            m_CurrentStatus = MediaStatus.Running;
            UpdateMediaButtons();

            //UpdateStatusBar();
            //UpdateToolBar();
        }
开发者ID:szopenfx,项目名称:code,代码行数:47,代码来源:GraphicalInterface2.cs

示例2: cmdOpen_Click

        private void cmdOpen_Click(object sender, EventArgs e)
        {
            // Allow the user to choose a file.
            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.Filter = "Media Files|*.mpg;*.avi;*.wma;*.mov;*.wav;*.mp2;*.mp3|All Files|*.*";
            
            if (DialogResult.OK == openFileDialog.ShowDialog())
            {
                // Stop the playback for the current movie, if it exists.
                if (mc != null) mc.Stop();
                mc = null;
                videoWindow = null;

                // Load the movie file.
                FilgraphManager graphManager = new FilgraphManager();
                graphManager.RenderFile(openFileDialog.FileName);

                // Attach the view to a picture box on the form.
                try
                {
                    videoWindow = (IVideoWindow)graphManager;
                    videoWindow.Owner = (int)pictureBox1.Handle;
                    videoWindow.WindowStyle = WS_CHILD | WS_CLIPCHILDREN;
                    videoWindow.SetWindowPosition(pictureBox1.ClientRectangle.Left,
                        pictureBox1.ClientRectangle.Top,
                        pictureBox1.ClientRectangle.Width,
                        pictureBox1.ClientRectangle.Height);
                }
                catch
                {
                    // An error can occur if the file does not have a vide
                    // source (for example, an MP3 file.)
                    // You can ignore this error and still allow playback to
                    // continue (without any visualization).
                }

                // Start the playback (asynchronously).
                mc = (IMediaControl)graphManager;
                mc.Run();
            }
        }
开发者ID:ehershey,项目名称:development,代码行数:41,代码来源:MoviePlayer.cs

示例3: OpenFileFunc

        public void OpenFileFunc(int filedex)
        {
            fileIndex = filedex;
            listoffilenames.SelectedIndex = fileIndex;
            object sender = new object();
            EventArgs er = new EventArgs();
            listoffilenames_SelectedIndexChanged(sender, er);
            ReLoad();
            itemList.Refresh();
            string openedfile = this.listoffilenames.Items[fileIndex].ToString();
            m_obj_FilterGraph = new FilgraphManager();
            try
            {
                m_obj_FilterGraph.RenderFile(openedfile);
            }
            catch (Exception)
            {
                MessageBox.Show("Please choose a valid file.\n Check the file path.\n File path could be changed.");
                return;
            }
            try
            {
                m_obj_BasicAudio = m_obj_FilterGraph as IBasicAudio;
                trackBar1.Value = volumeValue;
                m_obj_BasicAudio.Volume = trackBar1.Value;
                if (mute)
                {
                    volumeValue = -10000;
                    trackBar1.Value = volumeValue;
                    m_obj_BasicAudio.Volume = trackBar1.Value;
                }
            }
            catch { }

            try
            {
                if (!newPlayerIsCreated)
                {
                    playerform = new player(itemList, listoffilenames, fileIndex, filename);
                    newPlayerIsCreated = true;
                    playerform.Location = new Point(playerformLocationX, playerformLocationY);
                }
                m_obj_VideoWindow = m_obj_FilterGraph as IVideoWindow;
                m_obj_VideoWindow.Owner = (int)playerform.Handle;
                m_obj_VideoWindow.WindowStyle = WS_CHILD;
                videoplaying = true;
                m_obj_VideoWindow.SetWindowPosition(playerform.ClientRectangle.Left,
                    playerform.ClientRectangle.Top,
                    playerform.ClientRectangle.Right,
                    playerform.ClientRectangle.Bottom);
            }
            catch (Exception)
            {
                m_obj_VideoWindow = null;
                videoplaying = false;
            }

            if (videoplaying)
            {
                trackBar2.Enabled = true;
                trackBar1.Enabled = true;
                if (fullscreen)
                {
                    if (playerformactivatedonce == 0)
                        playerform.Show();
                    fullscreen = false;
                    fullscreenfunc();
                }
                else
                {
                    if (playerformactivatedonce == 0)
                        playerform.Show();
                }
                playerform.Activate();
            }
            else
            {
                trackBar2.Enabled = true;
                trackBar1.Enabled = true;
                playerformHeight = playerform.Height;
                playerformWidth = playerform.Width;
                playerformLocationX = playerform.Location.X;
                playerformLocationY = playerform.Location.Y;
                playerform.Dispose();
                newPlayerIsCreated = false;
            }
            running = true;
            m_obj_MediaEvent = m_obj_FilterGraph as IMediaEvent;
            m_obj_MediaEventEx = m_obj_FilterGraph as IMediaEventEx;
            m_obj_MediaEventEx.SetNotifyWindow((int)this.Handle, WM_GRAPHNOTIFY, 0);
            m_obj_MediaPosition = m_obj_FilterGraph as IMediaPosition;
            m_obj_MediaControl = m_obj_FilterGraph as IMediaControl;
            trackBar2.Maximum = (int)m_obj_MediaPosition.Duration;
            trackBar2.Minimum = 0;
            trackBar2.Value = (int)m_obj_MediaPosition.CurrentPosition;
            m_obj_MediaControl.Run();
            m_CurrentStatus = MediaStatus.Running;
            try
            {
                if (searchform != null)
//.........这里部分代码省略.........
开发者ID:Cantek,项目名称:CodeSamplesFromDifferentProjects,代码行数:101,代码来源:controlForm.cs

示例4: ConfigureVideoWindow

        // Configure the video window
        private void ConfigureVideoWindow(IVideoWindow videoWindow, GraphicsDevice hWin)
        {
            int hr;

            // Set the output window
            hr = videoWindow.put_Owner( hWin.Adapter.MonitorHandle ); //CHANGE
            DsError.ThrowExceptionForHR( hr );

            // Set the window style
            hr = videoWindow.put_WindowStyle( (WindowStyle.Child | WindowStyle.ClipChildren | WindowStyle.ClipSiblings) );
            DsError.ThrowExceptionForHR( hr );

            // Make the window visible
            hr = videoWindow.put_Visible( OABool.True );
            DsError.ThrowExceptionForHR( hr );

            // Position the playing location

            hr = videoWindow.SetWindowPosition( 0, 0, 1920, 600 );
            DsError.ThrowExceptionForHR( hr );
        }
开发者ID:Ryuzaki,项目名称:RVTN,代码行数:22,代码来源:Capture.cs

示例5: ConfigureVideoWindow

        private static void ConfigureVideoWindow(IVideoWindow videoWindow, Control hWin)
        {
            int hr = videoWindow.put_Owner(hWin.Handle);
            if (hr >= 0)
            {
                hr = videoWindow.put_WindowStyle((WindowStyle.Child | WindowStyle.ClipChildren | WindowStyle.ClipSiblings));
                DsError.ThrowExceptionForHR(hr);

                hr = videoWindow.put_Visible(OABool.True);
                DsError.ThrowExceptionForHR(hr);

                Rectangle rc = hWin.ClientRectangle;
                hr = videoWindow.SetWindowPosition(0, 0, rc.Right, rc.Bottom);
                DsError.ThrowExceptionForHR(hr);
            }
        }
开发者ID:markTwen,项目名称:TStreamSource,代码行数:16,代码来源:VideoPlay.cs

示例6: ConfigureVideoWindow

        // Configure the video window
        private void ConfigureVideoWindow(IVideoWindow videoWindow, Control hWin)
        {
            int hr;

            // Set the output window
            hr = videoWindow.put_Owner(hWin.Handle);
            DsError.ThrowExceptionForHR(hr);

            // Set the window style
            hr = videoWindow.put_WindowStyle((WindowStyle.Child | WindowStyle.ClipChildren | WindowStyle.ClipSiblings));
            DsError.ThrowExceptionForHR(hr);

            // Make the window visible
            hr = videoWindow.put_Visible(OABool.True);
            DsError.ThrowExceptionForHR(hr);

            // Position the playing location
            Rectangle rc = hWin.ClientRectangle;
            hr = videoWindow.SetWindowPosition(0, 0, rc.Right, rc.Bottom);
            DsError.ThrowExceptionForHR(hr);
        }
开发者ID:nikolasbe,项目名称:ugent-dma-videoshotdetection,代码行数:22,代码来源:DxPlay.cs

示例7: Initialize

        public override void Initialize(Control ownerControl, string videoFileName, EventHandler onVideoLoaded, EventHandler onVideoEnded)
        {
            const int wsChild = 0x40000000;

            var extension = System.IO.Path.GetExtension(videoFileName);
            if (extension == null)
            {
                return;
            }

            string ext = extension.ToLower();
            bool isAudio = ext == ".mp3" || ext == ".wav" || ext == ".wma" || ext == ".m4a";

            OnVideoLoaded = onVideoLoaded;
            OnVideoEnded = onVideoEnded;

            VideoFileName = videoFileName;
            owner = ownerControl;
            quartzFilgraphManager = new FilgraphManager();
            quartzFilgraphManager.RenderFile(VideoFileName);

            if (!isAudio)
            {
                quartzVideo = quartzFilgraphManager as IVideoWindow;
                if (quartzVideo != null)
                {
                    quartzVideo.Owner = (int)ownerControl.Handle;
                    quartzVideo.SetWindowPosition(0, 0, ownerControl.Width, ownerControl.Height);
                    quartzVideo.WindowStyle = wsChild;
                }
            }
            //Play();

            if (!isAudio)
            {
                var basicVideo = quartzFilgraphManager as IBasicVideo;
                if (basicVideo != null)
                {
                    basicVideo.GetVideoSize(out sourceWidth, out sourceHeight);
                }
            }

            owner.Resize += OwnerControlResize;
            mediaPosition = (IMediaPosition)quartzFilgraphManager;
            if (OnVideoLoaded != null)
            {
                videoLoader = new BackgroundWorker();
                videoLoader.RunWorkerCompleted += VideoLoaderRunWorkerCompleted;
                videoLoader.DoWork += VideoLoaderDoWork;
                videoLoader.RunWorkerAsync();
            }

            OwnerControlResize(this, null);
            videoEndTimer = new Timer { Interval = 500 };
            videoEndTimer.Tick += VideoEndTimerTick;
            videoEndTimer.Start();

            if (isAudio)
            {
                return;
            }

            if (quartzVideo != null)
            {
                quartzVideo.MessageDrain = (int)ownerControl.Handle;
            }
        }
开发者ID:AsenTahchiyski,项目名称:SoftUni-Projects,代码行数:67,代码来源:QuartsPlayer.cs

示例8: openMedia

        private void openMedia()
        {
            openFileDialog1.Filter = "Media Files|*.mpg;*.avi;*.wma;*.mov;*.wav;*.mp2;*.mp3|All Files|*.*";
            if (DialogResult.OK == openFileDialog1.ShowDialog()) {
                CleanUp();
                m_objFilterGraph = new FilgraphManager();
                m_objFilterGraph.RenderFile(openFileDialog1.FileName);
                m_objBasicAudio = m_objFilterGraph as IBasicAudio;

                try
                {
                    m_objVideoWindow = m_objFilterGraph as IVideoWindow;
                    m_objVideoWindow.Owner = (int)panel1.Handle;
                    m_objVideoWindow.WindowStyle = WS_CHILD | WS_CLIPCHILDREN;
                    m_objVideoWindow.SetWindowPosition(panel1.ClientRectangle.Left,
                        panel1.ClientRectangle.Top,
                        panel1.ClientRectangle.Width,
                        panel1.ClientRectangle.Height);
                }
                catch(Exception) {
                    m_objVideoWindow = null;
                }

                m_objMediaEvent = m_objFilterGraph as IMediaEvent;
                m_objMediaEventEx = m_objFilterGraph as IMediaEventEx;
                m_objMediaEventEx.SetNotifyWindow((int) this.Handle, WM_GRAPHNOTIFY, 0);
                m_objMediaPosition = m_objFilterGraph as IMediaPosition;
                m_objMediaControl = m_objFilterGraph as IMediaControl;
                this.Text = "Whistle- " + openFileDialog1.FileName + "]";
                m_objMediaControl.Run();
                m_CurrentStatus = MediaStatus.Running;

            }
        }
开发者ID:RoseySoft,项目名称:Whistle,代码行数:34,代码来源:Form1.cs

示例9: ConfigVideo

        private void ConfigVideo(IVideoWindow ivw, Control hControl)
        {
            int hr;

            hr = ivw.put_Owner(hControl.Handle);
            DsError.ThrowExceptionForHR(hr);

            hr = ivw.put_WindowStyle(WindowStyle.Child | WindowStyle.ClipChildren | WindowStyle.ClipSiblings);
            DsError.ThrowExceptionForHR( hr );

            // Yes, make it visible
            hr = ivw.put_Visible( OABool.True );
            DsError.ThrowExceptionForHR( hr );

            // Move to upper left corner
            Rectangle rc = hControl.ClientRectangle;
            hr = ivw.SetWindowPosition( 0, 0, rc.Right, rc.Bottom );
            DsError.ThrowExceptionForHR( hr );
        }
开发者ID:OmerMor,项目名称:DirectShowLib-FORK,代码行数:19,代码来源:Form1.cs

示例10: FileLoad

        //Мотод для загрузки видео файла.
        public void FileLoad(string sfile, Panel vPanel)
        {
            CleanUp();

            graphBuilder  = (IGraphBuilder) new FilterGraph();
            mediaControl  = graphBuilder as IMediaControl;
            mediaPosition = graphBuilder as IMediaPosition;
            videoWindow   = graphBuilder as IVideoWindow;
            basicAudio    = graphBuilder as IBasicAudio;

            ddColor.lBrightness = 0;
            ddColor.lContrast = 0;
            ddColor.lGamma = 0;
            ddColor.lSaturation = 0;

            graphBuilder.RenderFile(sfile, null);
            videoWindow.put_Owner(vPanel.Handle);
            videoWindow.put_WindowStyle(WindowStyle.Child
                                      | WindowStyle.ClipSiblings
                                      | WindowStyle.ClipChildren);
            videoWindow.SetWindowPosition(vPanel.ClientRectangle.Left,
                                          vPanel.ClientRectangle.Top,
                                          vPanel.ClientRectangle.Width,
                                          vPanel.ClientRectangle.Height);

            mediaControl.Run();
            CurrentStatus = mStatus.Play;
            mediaPosition.get_Duration(out mediaTimeSeconds);
            allSeconds = (int)mediaTimeSeconds;
        }
开发者ID:NVZver,项目名称:DirectShow,代码行数:31,代码来源:Media.cs

示例11: ConfigureVideoWindow

    /// <summary>
    /// Configure the video window
    /// </summary>
    /// <param name="videoWindow">Interface of the video renderer</param>
    /// <param name="previewControl">Preview Control to draw into</param>
    private void ConfigureVideoWindow(IVideoWindow videoWindow, Control previewControl)
    {
      int hr;

      if (previewControl == null)
      {
        return;
      }

      // Set the output window
      hr = videoWindow.put_Owner(ThreadSafe.GetHandle(previewControl));
      if (hr >= 0) // If there is video
      {
        // Set the window style
        hr = videoWindow.put_WindowStyle((WindowStyle.Child | WindowStyle.ClipChildren | WindowStyle.ClipSiblings));
        DsError.ThrowExceptionForHR(hr);

        // Make the window visible
        hr = videoWindow.put_Visible(OABool.True);
        DsError.ThrowExceptionForHR(hr);

        // Position the playing location
        Rectangle rc = ThreadSafe.GetClientRectangle(previewControl);
        hr = videoWindow.SetWindowPosition(0, 0, rc.Right, rc.Bottom);
        DsError.ThrowExceptionForHR(hr);
      }
    }
开发者ID:DeSciL,项目名称:Ogama,代码行数:32,代码来源:DSRecordWithDMO.cs

示例12: openFile

        public void openFile(string filename)
        {
            CleanUp();

            m_objFilterGraph = new FilgraphManager();
            m_objFilterGraph.RenderFile(filename);

           
            try
            {
                m_objVideoWindow = m_objFilterGraph as IVideoWindow;
                m_objVideoWindow.Owner = (int)panel1.Handle;
                m_objVideoWindow.WindowStyle = WS_CHILD | WS_CLIPCHILDREN;
                m_objVideoWindow.SetWindowPosition(panel1.ClientRectangle.Left,
                    panel1.ClientRectangle.Top,
                    panel1.ClientRectangle.Width,
                    panel1.ClientRectangle.Height);
            }
            catch (Exception)
            {
                m_objVideoWindow = null;
            }
            
        
            m_objMediaEvent = m_objFilterGraph as IMediaEvent;

            m_objMediaEventEx = m_objFilterGraph as IMediaEventEx;
            m_objMediaEventEx.SetNotifyWindow((int)this.Handle, WM_GRAPHNOTIFY, 0);

            m_objMediaPosition = m_objFilterGraph as IMediaPosition;

            m_objMediaControl = m_objFilterGraph as IMediaControl;

            this.Text = "Preview - [" + filename + "]";
            m_objMediaControl.Run();
            m_objMediaControl.Pause();
            

            UpdateStatusBar();
            UpdateToolBar();
        }
开发者ID:NeoBoy,项目名称:MiniCoder,代码行数:41,代码来源:Preview.cs

示例13: PlayVideo

        private bool PlayVideo(string path)
        {
            CleanUp();

            FilterGraph = new FilgraphManager();
            FilterGraph.RenderFile(path);

            BasicAudio = FilterGraph as IBasicAudio;

            try
            {
                VideoWindow = FilterGraph as IVideoWindow;
                VideoWindow.Owner = (int)panel1.Handle;
                VideoWindow.WindowStyle = WS_CHILD | WS_CLIPCHILDREN;
                VideoWindow.SetWindowPosition(panel1.ClientRectangle.Left,
                        panel1.ClientRectangle.Top,
                        panel1.ClientRectangle.Width,
                        panel1.ClientRectangle.Height);
            }
            catch (Exception)
            {
                VideoWindow = null;
                return false;
            }

            MediaEvent = FilterGraph as IMediaEvent;
            MediaEventEx = FilterGraph as IMediaEventEx;

            MediaPosition = FilterGraph as IMediaPosition;
            MediaControl = FilterGraph as IMediaControl;

            MediaControl.Run();
            return true;
        }
开发者ID:nrother,项目名称:fast-view,代码行数:34,代码来源:FVMultimediaPlugin.cs

示例14: resize

        //Player formunun büyüklük deðiþiminde çalýþacak fonksiyon...
        public void resize()
        {
            if (playerform.WindowState == FormWindowState.Maximized)
            {
                playerform.FormBorderStyle = FormBorderStyle.None;

                try
                {
                    m_obj_VideoWindow = m_obj_FilterGraph as IVideoWindow;
                    m_obj_VideoWindow.Owner = (int)playerform.Handle;
                    m_obj_VideoWindow.WindowStyle = WS_CHILD;
                    m_obj_VideoWindow.SetWindowPosition(playerform.ClientRectangle.Left,
                        playerform.ClientRectangle.Top,
                        playerform.ClientRectangle.Right,
                        playerform.ClientRectangle.Bottom);
                    playerform.Show();
                }
                catch (Exception)
                {
                    m_obj_VideoWindow = null;
                }

            }
            else
            {
                playerform.FormBorderStyle = FormBorderStyle.SizableToolWindow;
                try
                {
                    m_obj_VideoWindow = m_obj_FilterGraph as IVideoWindow;
                    m_obj_VideoWindow.Owner = (int)playerform.Handle;
                    m_obj_VideoWindow.WindowStyle = WS_CHILD;
                    m_obj_VideoWindow.SetWindowPosition(playerform.ClientRectangle.Left,
                        playerform.ClientRectangle.Top,
                        playerform.ClientRectangle.Right,
                        playerform.ClientRectangle.Bottom);
                    playerform.Show();
                }
                catch (Exception)
                {
                    m_obj_VideoWindow = null;
                }
            }
        }
开发者ID:Cantek,项目名称:CodeSamplesFromDifferentProjects,代码行数:44,代码来源:controlForm.cs

示例15: MediaPreviewer_Load

        private void MediaPreviewer_Load(object sender, EventArgs e)
        {
            statusBarPanel1.Text = "Buffering !! Please  Wait";
                CleanUp();
                Console.WriteLine("download finished");
                m_objFilterGraph = new FilgraphManager();

                try
                {
                        m_objFilterGraph.RenderFile(fileName);
                }
                catch (Exception ex)
                {
                        return;
                }

                m_objBasicAudio = m_objFilterGraph as IBasicAudio;

                try
                {
                    m_objVideoWindow = m_objFilterGraph as IVideoWindow;
                    m_objVideoWindow.Owner = (int) panel1.Handle;
                    m_objVideoWindow.WindowStyle = WS_CHILD | WS_CLIPCHILDREN;
                    m_objVideoWindow.SetWindowPosition(panel1.ClientRectangle.Left,
                        panel1.ClientRectangle.Top,
                        panel1.ClientRectangle.Width,
                        panel1.ClientRectangle.Height);
                }
                catch (Exception)
                {
                    m_objVideoWindow = null;
                }

                m_objMediaEvent = m_objFilterGraph as IMediaEvent;

                m_objMediaEventEx = m_objFilterGraph as IMediaEventEx;
                m_objMediaEventEx.SetNotifyWindow((int) this.Handle,WM_GRAPHNOTIFY, 0);

                m_objMediaPosition = m_objFilterGraph as IMediaPosition;

                m_objMediaControl = m_objFilterGraph as IMediaControl;

                this.Text = "SMART MediaPreviewer";

                m_objMediaControl.Run();
                m_CurrentStatus = MediaStatus.Running;

                UpdateStatusBar();
                UpdateToolBar();
        }
开发者ID:niranjan-nagaraju,项目名称:SMART-Downloader,代码行数:50,代码来源:MediaPreviewer.cs


注:本文中的IVideoWindow.SetWindowPosition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。