VB.NET - 无法使视频预览工作

发布于 2024-09-03 16:49:24 字数 702 浏览 13 评论 0原文

溢出。我有一个应用程序应该通过 DirectShowSource 转换视频。
我有一个复选框,它启用一个名为“btnviewcrop”的按钮,该按钮显示一个名为 crp.vb 的新表单,用于裁剪/剪切视频中的像素。

现在,我有一个 Panel1,我想将其设置为所有者(视频绘图表面),但是当我将其设置为打开时,应用程序崩溃(错误:对象引用未设置为对象的实例。)并且我不这样做了解如何修复它。

这是我的按钮代码:

Imports Microsoft.DirectX.AudioVideoPlayback
Private Sub btnviewcrop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnviewcrop.Click
     Me.ShowInTaskbar = False
     Me.Enabled = False
     crp.Show()
     Dim cropperv As Video
     cropperv.Owner = crp.preview 'VS2010 reports that cropperv has been used before being assigned a value'
     cropperv.FromFile(labinputfile.Text, True)
     cropperv.Play()
End Sub

Overflow. I have an application which is supposed to convert a video via DirectShowSource.
I have a checkbox which enables a button called "btnviewcrop" which shows a new form called crp.vb for cropping/shearing pixels off the video.

Now, I have a Panel1 that I want to set as the owner (the video drawing surface) but when I set it to open, the application crashes (Error: Object reference not set to an instance of an object.) and I do not understand how to fix it.

Here is my button code:

Imports Microsoft.DirectX.AudioVideoPlayback
Private Sub btnviewcrop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnviewcrop.Click
     Me.ShowInTaskbar = False
     Me.Enabled = False
     crp.Show()
     Dim cropperv As Video
     cropperv.Owner = crp.preview 'VS2010 reports that cropperv has been used before being assigned a value'
     cropperv.FromFile(labinputfile.Text, True)
     cropperv.Play()
End Sub

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

倦话 2024-09-10 16:49:24

我认为您从未将任何内容分配给 cropperv。你的意思

Dim cropperv As New DirectX.AudioVideoPlayback

I don't think you ever assign anything to cropperv. Did you mean

Dim cropperv As New DirectX.AudioVideoPlayback
箹锭⒈辈孓 2024-09-10 16:49:24

好点,如果我这样做:

Dim cropperv As New Video(labinputfile.Text, True)
cropperv.Owner = crp.preview
cropperv.Play()

那么除了需要完成调整大小之外,一切都很好。
我很感谢你的帮助,马蒂。

Good point, and if I do this:

Dim cropperv As New Video(labinputfile.Text, True)
cropperv.Owner = crp.preview
cropperv.Play()

Then all works out fine besides the resizing needs done.
I appreciate the help, Matti.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文