Page 1 of 1

Horizontal ScrollBar/Seek Bar Code

Posted: Tue Sep 15, 2009 9:23 pm
by hungryhounduk
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 )
Code: Select all
PlayerControl.settings.autoStart = True
        PlayerControl.settings.volume = VolumeBar.Value
PlayBar Scroll Code ( Horizontal Scrollbar after being Renamed )
Code: Select all
 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
And thats it

Easy Huh :)

Chris

Re: Horizontal ScrollBar/Seek Bar Code

Posted: Tue Sep 15, 2009 10:07 pm
by CodenStuff
Hello hungryhounduk,

LOL you must have read my mind, I was just about to hunt through my code to find this because I needed it to test something out.

Good work Derren Brown ;) cooll;

Re: Horizontal ScrollBar/Seek Bar Code

Posted: Tue Sep 15, 2009 10:38 pm
by Nery
Derren Brown, great name indeed ;P
I like most of the English names, they sound so cool!

Anyway, Interesting to know that you like mountain biking, because I make mountain biking too, it's so exciting!


----- // -----

Now talking about your snippeT:

Hmm I was wondering how you made that bar in your MP3 Player before I saw this, It also helped me understanding how to add scrollbars, not just in MP3 Players but also in other applications

Greets,
Nery

Re: Horizontal ScrollBar/Seek Bar Code

Posted: Wed Sep 16, 2009 1:26 am
by Robby
lol yay u made this in no time i might make a ipod player simple one can i use this for it?
i will also credit ufor it since this is like a good thing

Re: Horizontal ScrollBar/Seek Bar Code

Posted: Wed Sep 16, 2009 4:28 am
by hungryhounduk
Hi Codenstuff, Nery, Robby1998
Glad you can make use of it cooll;
It certainly does give a Mp3 Player or Media Application a bit more functionality

Respect

Chris