示例#1
0
 private void playTimer_Tick(System.Object sender, System.EventArgs e)
 {
     if (mMusicPlayer.PlaybackState == CSCore.SoundOut.PlaybackState.Playing)
     {
         lblCursorPos.Text = mPlaySource.GetPosition().ToString(@"hh\:mm\:ss\.ff");
         if (mPlaySource.Position >= mStreamEnd)
         {
             StopPlaying();
         }
         else
         {
             int playCursorX = (int)((mPlaySource.Position - mDrawingStartOffset) / mSamplesPerPixel);
             if (playCursorX != mLastPlayCursorX)
             {
                 if (playCursorX < CWidth && playCursorX >= 0)
                 {
                     mLastPlayCursorX = playCursorX;
                     Refresh();
                 }
                 else
                 {
                     ScrollView((int)(mPlaySource.Position));
                 }
             }
         }
     }
     else
     {
         progress.Value = 0;
     }
 }