D
Doctor GME
Guest
i have a main form with a button named (Open videos), when clicked
a second form (form2) will open like this:
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:
this is the code of form1 to make it parent:
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:
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
tried a different code with no success:
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
Continue reading...
a second form (form2) will open like this:
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:
this is the code of form1 to make it parent:
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:
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
tried a different code with no success:
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
Continue reading...