本文整理汇总了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();
}
示例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();
}
}
示例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)
//.........这里部分代码省略.........
示例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 );
}
示例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);
}
}
示例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);
}
示例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;
}
}
示例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;
}
}
示例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 );
}
示例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;
}
示例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);
}
}
示例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();
}
示例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;
}
示例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;
}
}
}
示例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();
}