Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a main form with a button named (Open videos), when clicked
a second form (form2) will open like this:

https://www2.0zz0.com/2020/04/20/23/422181175.jpg[^]

form2 has a combobox which has a list of videos
if any item of this combobox is selected, a video start playing
also full screen mode is working fine
but when form2 become (child form) to form1
video isn't scaled right also full screen mode doesn't work like this:

https://www5.0zz0.com/2020/04/20/23/983918628.jpg[^]

this is the code of form1 to make it parent

VB
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    Form2.StartPosition = FormStartPosition.Manual
    Form2.Left = 105
    Form2.Top = 50
    Form2.MdiParent = Me

End Sub


and this is code of form2 to play videos:

VB
<pre>Public Class Form2
    Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged

        If ComboBox1.SelectedItem = "Video 1" Then

            On Error Resume Next
            IO.File.WriteAllBytes(IO.Path.GetTempPath & "\Video 1.mp4", My.Resources.Video_2)
            AxWindowsMediaPlayer1.URL = IO.Path.GetTempPath & "\Video 1.mp4"
            IO.File.Delete(IO.Path.GetTempPath & "\Video 1.mp4")

        End If

        If ComboBox1.SelectedItem = "Video 2" Then

            On Error Resume Next
            IO.File.WriteAllBytes(IO.Path.GetTempPath & "\Video 2.mp4", My.Resources.Video_2)
            AxWindowsMediaPlayer1.URL = IO.Path.GetTempPath & "\Video 2.mp4"
            IO.File.Delete(IO.Path.GetTempPath & "\Video 2.mp4")

        End If

        If ComboBox1.SelectedItem = "Video 3" Then

            On Error Resume Next
            IO.File.WriteAllBytes(IO.Path.GetTempPath & "\Video 3.mp4", My.Resources.Video_3)
            AxWindowsMediaPlayer1.URL = IO.Path.GetTempPath & "\Video 3.mp4"
            IO.File.Delete(IO.Path.GetTempPath & "\Video 3.mp4")

        End If

    End Sub

End Class


What I have tried:

tried a different code with no success:

VB
If ComboBox1.SelectedItem = "Video 1" Then

    Dim b As Byte() = My.Resources.Video_1
    Dim TheFIlePath As String = "Video 1.mp4"
    Dim TempFile As IO.FileStream = IO.File.Create(TheFIlePath)
    TempFile.Write(b, 0, b.Length)
    TempFile.Close()
    AxWindowsMediaPlayer1.URL = (TheFIlePath)

End If
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900