如何将其他控件置于视频之上?

时间:2012-01-09 19:29:44

标签: vb.net video mcisendstring

我使用mciSendString播放视频,但我无法在视频顶部放置任何标签或按钮等控件。如何在视频顶部放置另一个控件?

以下是代码:

  

Public Class Form1

     

私有声明函数mciSendString Lib“winmm.dll”别名   “mciSendStringA”(ByVal lpstrCommand As String,ByVal   lpstrReturnString As String,ByVal uReturnLength As Integer,ByVal   hwndCallback As Integer)As Integer

     

Dim filename As String

     

Dim retVal As Integer

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
    filename = Chr(34) & "D:\farm.wmv" & Chr(34)
    retVal = mciSendString("open " & filename & " type mpegvideo alias movie parent " & Panel1.Handle.ToInt32 & " style child", 0, 0, 0)

    retVal = mciSendString("put movie window at 0 0 201 127", 0, 0, 0)
    retVal = mciSendString("play movie", 0, 0, 0)
 End Sub   End Class

之前:(按钮1可见)

enter image description here

之后:(按钮1不再可见)

enter image description here

1 个答案:

答案 0 :(得分:0)

将集合中指定子控件的索引设置为指定的索引值。

Control.ControlCollection.SetChildIndex方法

例如,如果按钮位于图片框控件内,则只需设置:

PictureBox.Controls.Setchildindex(control,newIndex)

这将完成这项工作。