What's new

.NET WMP time line ?

  • Thread starter Quast
  • Start date
  • Views 271
Q

Quast

Enthusiast
Messages
90
Reaction score
4
Hi
I'm working on a player, so i install WMP and hide all buttons and make my own buttons. but i faced a problem with the Time Line

timeline.png


so how to make one similar ?
 
Q

Quast

Enthusiast
Messages
90
Reaction score
4
thank you for you reply
what i miss now is a code or tutorial guide me
i'm not very good with coding, if you have please write it

Thank you again
 
Z

Z61

Some times our saints are sinners
Retired
Messages
5,476
Reaction score
3,426
There should be a property for the control to hide it.
 
Q

Quast

Enthusiast
Messages
90
Reaction score
4
i want to make one similar to that on WMP
 
X

Xeren

♦♦♦ God Complex ♦♦♦
Messages
5,671
Reaction score
2,120
Using WPF, I'd use the fact that it just looks like a progress bar with a drag-able button or image. The hardest part would be getting the two to work together.
 
D

dudeeitsbrian

Reefer Smoker
Messages
2,393
Reaction score
1,924
I have a concept on how you could get it to work, but I'm too lazy to try it.... so I'll just explain my idea.

1.) Create a background worker control just to keep things simple.
2.) Add the image you wish to use as the slider, and instantiate both a MouseDown, and MouseUp event for it.
3.) Create a global variable called IsSliding or something like that.
4.) In the backgroundWorker_doWork function, make a while loop that continues looping while IsSliding is true.
5.) When the MouseDown event occurs, set IsSliding = true, then call backgroundWorker.RunWorkerAsync(), for MouseUp set IsSliding = false
6.) In the backgroundWorker_doWork function, continuously grab the X position of the mouse on your screen, calculate the relative coordinate of the mouse on your form based on the x/y of your application, and set the pictures X coordinate to that coordinate.

Then the only thing left to do is to make sure the picture isn't able to be moved passed a certain X coordinate in either direction, there are a lot of ways you could accomplish this but I'll leave that to you to figure out.

Hopefully this helps :smile:

Edit: You might also consider adding some type of handling in the backgroundWorker_doWork function to make sure that the application is in focus; then if it goes into the background end the doWork function.

Also, in order to adjust the seek accordingly to the correct position what I'd do is calculate a percentage based on the max/min position of the slider and its current position, then calculate that percentage into a time based on the total length of the song/video.
 
Last edited:
O

ObscureCoder

Enthusiast
Messages
685
Reaction score
308
I still don't get what the problem is. The WMP timeline worked perfectly for me by itself when I used it.
 
Top Bottom