Fixed seeking on specific click on trackbar

This commit is contained in:
Janco Kock
2015-10-31 16:09:44 +01:00
parent 3ccfdbe282
commit 6a9b2956de
2 changed files with 11 additions and 3 deletions
+4 -3
View File
@@ -324,7 +324,7 @@ namespace MusicPlayer
this.PlayNextSongButton.CheckOnClick = true;
this.PlayNextSongButton.CheckState = System.Windows.Forms.CheckState.Checked;
this.PlayNextSongButton.Name = "PlayNextSongButton";
this.PlayNextSongButton.Size = new System.Drawing.Size(152, 22);
this.PlayNextSongButton.Size = new System.Drawing.Size(123, 22);
this.PlayNextSongButton.Text = "Play Next";
//
// LoopSongButton
@@ -333,7 +333,7 @@ namespace MusicPlayer
this.LoopSongButton.CheckOnClick = true;
this.LoopSongButton.CheckState = System.Windows.Forms.CheckState.Checked;
this.LoopSongButton.Name = "LoopSongButton";
this.LoopSongButton.Size = new System.Drawing.Size(152, 22);
this.LoopSongButton.Size = new System.Drawing.Size(123, 22);
this.LoopSongButton.Text = "Loop";
//
// ShuffleSongButton
@@ -341,7 +341,7 @@ namespace MusicPlayer
this.ShuffleSongButton.CheckOnClick = true;
this.ShuffleSongButton.Enabled = false;
this.ShuffleSongButton.Name = "ShuffleSongButton";
this.ShuffleSongButton.Size = new System.Drawing.Size(152, 22);
this.ShuffleSongButton.Size = new System.Drawing.Size(123, 22);
this.ShuffleSongButton.Text = "Shuffle";
//
// playlistToolStripMenuItem
@@ -500,6 +500,7 @@ namespace MusicPlayer
this.PositionTrackBar.Size = new System.Drawing.Size(778, 45);
this.PositionTrackBar.TabIndex = 7;
this.PositionTrackBar.TickStyle = System.Windows.Forms.TickStyle.None;
this.PositionTrackBar.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PositionTrackBar_MouseDown);
//
// BufferLabel
//
+7
View File
@@ -377,5 +377,12 @@ namespace MusicPlayer
SearchGenresTextBox.Text = "";
ClearGenreSearchButton.Enabled = false;
}
private void PositionTrackBar_MouseDown(object sender, MouseEventArgs e)
{
double dblValue;
dblValue = ((double)(e.X+PositionTrackBar.Location.X) / (double)(PositionTrackBar.Width + PositionTrackBar.Location.X)) * (PositionTrackBar.Maximum - PositionTrackBar.Minimum);
PositionTrackBar.Value = Convert.ToInt32(dblValue);
}
}
}