我想实现如下效果,程序运行时,先播放一段视频,然后出现主界面,我该怎么做呢?我现在可以用mediaplayer播放视频,但视频完了,就停在那了,主界面出不来,怎么办啊?

解决方案 »

  1.   

    var
      StartVideo:TMediaPlayer;
    begin 
      StartVideo:=TMediaPlayer.Create(self);
      StartVideo.Parent:=MainForm;
      StartVideo.Top:=MainForm.Top;
      StartVideo.Left:=MainForm.Left;
      StartVideo.ClientWidth:=MainForm.Width;
      StartVideo.ClientHeight:=MainForm.Height;
      StartVideo.AutoOpen:=True;
      StartVideo.Display:=MainForm;
      StartVideo.FileName:='……';
      StartVideo.Visible:=false;
      StartVideo.Open;
      startvideo.DisplayRect:=MainForm.ClientRect;
      StartVideo.Play;
      sleep(StartVideo.Length);//sleep视频长度的时间就关掉
      StartVideo.Close;
    end;