Beispiel #1
0
        private void 開くOToolStripMenuItem_Click(object sender, EventArgs e)
        {
            openFileDialog1.Filter = "MIDIファイル(*.mid)|*.mid";
            openFileDialog1.ShowDialog();
            var filePath = openFileDialog1.FileName;

            if (string.IsNullOrWhiteSpace(filePath) || !File.Exists(filePath))
            {
                return;
            }

            if (mPlayer.IsPlay)
            {
                mPlayer.Stop();
                btnPalyStop.Text = "再生";
            }

            try {
                mSMF = new SMF.SMF(filePath);
                mPlayer.SetEventList(mSMF.EventList);
                hsbSeek.Maximum = mPlayer.MaxTick;
                Text            = Path.GetFileNameWithoutExtension(filePath);
            }
            catch (Exception ex) {
                MessageBox.Show(ex.ToString());
            }
        }