如何在WPF应用程序中使用TVideoGrabber

   要在WPF 中使用 TVideoGrabber 组件,需要像下面的方法来使用 VS.NET(DLL) 版本的组件:

——复制TVideoGrabber_x.x.x.x_x86.dll到c:/windows/syswow64 (1)

——复制TVideoGrabber_x.x.x.x_x64.dll到c:/windows/system32 (1)

——根据你使用的VS版本来添加VideoGrabberNETx.x引用到你的application (2)

  1. 这个复制只是开发平台的需要,要发布应用程序的话,你需要分发在你application .EXE的同一文件夹中的x86 和x64 DLLs。
  2. 这个TVideoGrabber WPF组件需要Visual Studio 2010 (NET4.0),Visual Studio 2012 (NET 4.5) 或是更高的版本。

C#应用程序

    通过假设里面视频将会以 “image1”命名显示的WPF控件,如下实例化一个VideoGrabberWPF的实例并连接OnFrameRefresh事件:

using VidGrabNoForm;
namespace WpfApplication1
public partial class MainWindow : Window
VideoGrabberWPF Vg;
public MainWindow()
InitializeComponent();
image1.Stretch = Stretch.UniformToFill;
Vg = new VideoGrabberWPF();
Vg.OnFrameRefresh += new VideoGrabberWPF.On_WPF_FrameRefreshHandler(Vg_OnFrameRefresh);
void Vg_OnFrameRefresh(object sender, VideoGrabberWPF.TOn_WPF_FrameRefreshArgs e)
image1.Source = e.BitmapSource;

 

VB应用程序

    通过假设里面视频将会以 “image1”命名显示的WPF控件,如下实例化一个VideoGrabberWPF的实例并连接OnFrameRefresh事件:

Class Window1
Public Vg As VideoGrabberWPF
Public Sub New()
InitializeComponent()
image1.Stretch = Stretch.UniformToFill
Vg = New VideoGrabberWPF()
AddHandler Me.Vg.OnFrameRefresh, New VideoGrabberWPF.On_WPF_FrameRefreshHandler(AddressOf Vg_OnFrameRefresh)
End Sub
Private Sub Vg_OnFrameRefresh(ByVal sender As Object, ByVal e As VideoGrabberWPF.TOn_WPF_FrameRefreshArgs)
image1.Source = e.BitmapSource
End Sub

    然后你就可以开始预览、录像、回放或重新编码,并使用在MainDemo项目中以同样方式显示的事件,除了在WPF控件中出现的视频。比如:

Vg.PlayerFileName = "myclip.wmv"

Vg.OpenPlayer()

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值