Horizontal ScrollBar/Seek Bar Code
Posted: Tue Sep 15, 2009 9:23 pm
Hi All
Here is a bit of code you can use with your MediaPlayers, and by adding a Horizontal ScrollBar Component you will be able to Drag the Slider to any position within the Track you are playing cooll;
The best way i found using this was to Change my FORM1 name to Player.vb
I am using a Horizontal Scrollbar ( Renamed to ScrollBar in the Properties )
Set the Maximum value to 100
And my MediaPlayer Component has been ( Renamed to PlayerControl in the Properties )
Player Load Code (Which was Form1 Load before i renamed it )
Easy Huh
Chris
Here is a bit of code you can use with your MediaPlayers, and by adding a Horizontal ScrollBar Component you will be able to Drag the Slider to any position within the Track you are playing cooll;
The best way i found using this was to Change my FORM1 name to Player.vb
I am using a Horizontal Scrollbar ( Renamed to ScrollBar in the Properties )
Set the Maximum value to 100
And my MediaPlayer Component has been ( Renamed to PlayerControl in the Properties )
Player Load Code (Which was Form1 Load before i renamed it )
Code: Select all
PlayBar Scroll Code ( Horizontal Scrollbar after being Renamed )PlayerControl.settings.autoStart = True
PlayerControl.settings.volume = VolumeBar.Value
Code: Select all
And thats it Try
If (PlayerControl.currentMedia.duration <> 0) Then
Dim NewPerc As Double = Convert.ToDouble(PlayBar.Value) / 100
Dim DurationVar As Integer = Convert.ToInt32(PlayerControl.currentMedia.duration * 1000) ' milliseconds
Dim NewPos As Integer = (DurationVar * NewPerc) / 1000
PlayerControl.Ctlcontrols.currentPosition = NewPos
Else
PlayBar.Value = 0
End If
Catch ex As Exception
End Try
Easy Huh

Chris