问题描述
void __fastcall TForm1 :: MediaPlayer1Click(TObject * Sender,TMPBtnType Button,bool& DoDefault)
void __fastcall TForm1::MediaPlayer1Click(TObject *Sender, TMPBtnType Button, bool &DoDefault)
{
if( Button = btPlay)
{
TOpenDialog * OpenMediaDialog ; $
OpenMediaDialog =新的TOpenDialog(this);
OpenMediaDialog-> Filter ="所有音频文件(* .mp3)| * .mp3" ; //加上更多¥b $ b if(OpenMediaDialog->执行())
{
MediaPlayer1-> FileName = OpenMediaDialog-> FileName;
MediaPlayer1-> Wait = true;
MediaPlayer1-> Open();
MediaPlayer1-> Play();
MediaPlayer1-> ;位置= 0;
if (Button=btPlay)
{
TOpenDialog * OpenMediaDialog ;
OpenMediaDialog = new TOpenDialog(this);
OpenMediaDialog->Filter= "All audio files(*.mp3)|*.mp3";//plus more
if(OpenMediaDialog->Execute())
{
MediaPlayer1->FileName = OpenMediaDialog->FileName;
MediaPlayer1->Wait = true;
MediaPlayer1->Open();
MediaPlayer1->Play();
MediaPlayer1->Position= 0;
}
}
if(Button = btPause)
{
}
if (Button=btPause)
{
MediaPlayer1->暂停();
MediaPlayer1->Pause();
}
}
}
//
}
//
John
推荐答案
尝试将Button设置为btPlay。 要测试相等性,你需要==,而不是
That attempts to set Button to btPlay. To test for equality you need ==, not =
这篇关于为什么我的代码不能正常工作呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!