|
-
Dec 13th, 2005, 10:01 PM
#41
Re: Clicking a progress bar and making the value the mouse's position
 Originally Posted by paralinx
can someone come up with a way to do this without the max being only 100??
As I mentioned Set the .Max = SongLength
That way the PB 'ticks' are representative of the song play postion....
You would set the .Max at song load, and update the .Value based on the Song position.
Does that make sense? Or, am I missing the obvious?
-
Dec 13th, 2005, 11:02 PM
#42
Re: Clicking a progress bar and making the value the mouse's position
Wouldn't it be so much easier to ditch the progressbar and use a picturebox instead? Simply set the ScaleWidth property to the length of the song and to update the progress in it simply do this:
VB Code:
Public Sub ProgressValue(pic As PictureBox, nValue As Long)
pic.Line (nValue, 0) - (pic.ScaleWidth, pic.ScaleHeight), pic.BackColor, BF
pic.Line (0, 0)-(nValue, pic.ScaleHeight), vbBlue, BF
End Sub
The AutoRedraw property should be set to True.... Now in the MouseDown event use the X value directly to change the position in the current song and to update the progress in the picturebox.
-
Dec 13th, 2005, 11:48 PM
#43
Re: Clicking a progress bar and making the value the mouse's position
I was gonna post about ScaleMode until I read JA's post. paralinx, you probably changed the ScaleMode property of your form, which is why it works with new projects.
-
Dec 13th, 2005, 11:51 PM
#44
Re: Clicking a progress bar and making the value the mouse's position
 Originally Posted by paralinx
do you know a way where I can change the computer's volume control that is found in the bottom right hand corner?
You shouldn't alter that unless you really have to. Whatever method you're using to play audio, that should have a way of controlling its own volume.
-
Dec 14th, 2005, 08:42 AM
#45
Thread Starter
Fanatic Member
Re: Clicking a progress bar and making the value the mouse's position
I'd need a way to update the picture box during the song like the progress bar then. And I have no idea how.
-
Dec 14th, 2005, 08:56 AM
#46
Re: Clicking a progress bar and making the value the mouse's position
You update the ProgressBar now by simply setting the Value property right? Well instead of setting the Value property call the ProgressValue Sub I showed above.
-
Dec 14th, 2005, 02:56 PM
#47
Re: Clicking a progress bar and making the value the mouse's position
 Originally Posted by paralinx
I'd need a way to update the picture box during the song like the progress bar then. And I have no idea how.
As your no doubt aware you will need to be constantly cycling this app so that you can update the statusbar/picturebox, display the current song time, maybe time remaining. To do that you could use a Timer, a Loop etc. I think
you mentioned
that you are using a Timer - is that right?
To put it simply, you will need something like:
VB Code:
'A.
Private Sub Timer1_Timer()
'Main code executes here (updates labels, progressbars etc)
End Sub
'OR
'B.
Do Until Stop
'Main code executes here (updates labels, progressbars etc)
Loop
Therefore, can you post the code that you have that performs the pseudo function above
-
Dec 14th, 2005, 09:05 PM
#48
Thread Starter
Fanatic Member
Re: Clicking a progress bar and making the value the mouse's position
Joacim, I am working with your code, and it will only update the picturebox once. Am i doing something wrong?
VB Code:
Private Sub tmrTimer_Timer()
Dim nReturnCode As Long
Dim dblPosition As Double
On Local Error GoTo ErrLine
Call ProgressValue(Pic, m_objMediaPosition.CurrentPosition)
End Sub
Public Sub ProgressValue(Pic As PictureBox, nValue As Long)
Pic.Line (nValue, 0)-(Pic.ScaleWidth, Pic.ScaleHeight), Pic.BackColor, BF
Pic.Line (0, 0)-(nValue, Pic.ScaleHeight), vbBlue, BF
End Sub
-
Dec 15th, 2005, 05:58 AM
#49
Re: Clicking a progress bar and making the value the mouse's position
Have you set the ScaleWidth of the picturebox to the length of the song? You might need to also set the ScaleMode property to vbUser (this can be done during design time). The ScaleWidth will then act as the Max property.
-
Dec 15th, 2005, 06:23 AM
#50
Re: Clicking a progress bar and making the value the mouse's position
Whats wrong with the slider from the microsoft common controls? Or even a scroll bar?
-
Dec 15th, 2005, 07:24 AM
#51
Thread Starter
Fanatic Member
Re: Clicking a progress bar and making the value the mouse's position
 Originally Posted by Joacim Andersson
Have you set the ScaleWidth of the picturebox to the length of the song? You might need to also set the ScaleMode property to vbUser (this can be done during design time). The ScaleWidth will then act as the Max property.
Ok I got it working now. Would you know the code for when I click anyone on the picture box that i could set the position of the blue line to where the mouse click was?
-
Dec 15th, 2005, 08:34 AM
#52
Re: Clicking a progress bar and making the value the mouse's position
In the MouseDown or MouseUp event use the X argument to determent what value you should set the CurrentPosition of the song to. The Timer event will then update the picture box.
-
Dec 15th, 2005, 05:48 PM
#53
Thread Starter
Fanatic Member
Re: Clicking a progress bar and making the value the mouse's position
Holy cow! It's a miracle I got it to work finally!
Thanks every so much for all you're help!
Here's the final code that I used
VB Code:
m_objMediaPosition.CurrentPosition = (X * m_objMediaPosition.Duration) / Pic.ScaleWidth
-
Dec 15th, 2005, 08:26 PM
#54
Re: Clicking a progress bar and making the value the mouse's position(resolved)
Well, I'm glad you got it working However if you would have set the ScaleWidth of the picture box to the duration of the song whenever a new song is selected you shouldn't need to do the above calculation.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|