⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit_main.pas

📁 这是一个用Delphi开发的MP3播放器的源码
💻 PAS
📖 第 1 页 / 共 3 页
字号:
except
     exit;
   end;
end;

procedure TFrm_Main.Menu_RoundomClick(Sender: TObject);
begin
try
     Frm_Main.Roundom_Play := True;
     Frm_Main.Menu_Roundom.Checked := True;
     Frm_Main.Menu_ShunXu.Checked := False;
except
     exit;
   end;
end;

procedure TFrm_Main.Menu_ShunXuClick(Sender: TObject);
begin
try
     Frm_Main.Roundom_Play := False;
     Frm_Main.Menu_Roundom.Checked := False;
     Frm_Main.Menu_ShunXu.Checked := True;
except
     exit;
   end;
end;

procedure TFrm_Main.Menu_ZPPLClick(Sender: TObject);
begin
try
     if (Frm_Main.List_Boot = True) and (Frm_Main.Work_Boot = True) then
         begin
              Frm_List.Top := Frm_Main.Top + Frm_Main.Height;
              Frm_List.Left := Round(Frm_Main.Left - Frm_Main.Width /2);
              Frm_Work.Top := Frm_List.Top;
              Frm_Work.Left := Round(Frm_Main.Left + Frm_Main.Width /2);
         end;
except
     exit;
   end;
end;

procedure TFrm_Main.Menu_DPPLClick(Sender: TObject);
begin
try
     if (Frm_Main.List_Boot = True) and (Frm_Main.Work_Boot = True) then
         begin
              Frm_List.Top := Frm_Main.Top - Frm_List.Height;
              Frm_List.Left := Round(Frm_Main.Left - Frm_Main.Width /2);
              Frm_Work.Top := Frm_List.Top;
              Frm_Work.Left := Round(Frm_Main.Left + Frm_Main.Width /2);
         end;
except
     exit;
   end;
end;

procedure TFrm_Main.Menu_YCPLClick(Sender: TObject);
begin
try
     if (Frm_Main.List_Boot = True) and (Frm_Main.Work_Boot = True) then
         begin
              Frm_List.Top := Frm_Main.Top;
              Frm_List.Left := Round(Frm_Main.Left - Frm_Main.Width);
              Frm_Work.Top := Frm_List.Top;
              Frm_Work.Left := Round(Frm_Main.Left + Frm_Main.Width);
         end;
except
     exit;
   end;
end;

procedure TFrm_Main.Menu_CDPLClick(Sender: TObject);
begin
try
     if (Frm_Main.List_Boot = True) and (Frm_Main.Work_Boot = True) then
         begin
              Frm_List.Top := Frm_Main.Top + Frm_Main.Height;
              Frm_List.Left := Round(Frm_Main.Left);
              Frm_Work.Top := Frm_Main.Top + Frm_Main.Height+Frm_List.Height;;
              Frm_Work.Left := Round(Frm_Main.Left);
         end;
except
     exit;
   end;
end;

procedure TFrm_Main.Menu_XiaPlayClick(Sender: TObject);
var
   Play_Index:Integer;
begin
try
if Frm_Main.Roundom_Play = True then
    begin
         Play_Index:= Round(Random(Frm_Main.CheckListBox.Items.Count));
         Frm_Main.Play_Sounder(Frm_Main.CheckListBox.Items.Strings[Play_Index]);
         Frm_Main.CheckListBox.ItemIndex := Play_Index;
            if Frm_Main.List_Boot = True then
               Frm_List.CheckListBox.ItemIndex := Frm_Main.CheckListBox.ItemIndex;
    end;
if Frm_Main.Roundom_Play = False then
   begin
        if  Frm_Main.CheckListBox.ItemIndex < Frm_Main.CheckListBox.Items.Count-1  then
            Play_Index:=Frm_Main.CheckListBox.ItemIndex + 1
            else
                Play_Index:=0;
                Frm_Main.Play_Sounder(Frm_Main.CheckListBox.Items.Strings[Play_Index]);
                Frm_Main.CheckListBox.ItemIndex := Play_Index;
                if Frm_Main.List_Boot = True then
                   Frm_List.CheckListBox.ItemIndex := Frm_Main.CheckListBox.ItemIndex;
   end;
except
     exit;
   end;
end;

procedure TFrm_Main.Menu_ShangPlayClick(Sender: TObject);
var
   Play_Index:Integer;
begin
try
if Frm_Main.Roundom_Play = True then
    begin
         Play_Index:= Round(Random(Frm_Main.CheckListBox.Items.Count));
         Frm_Main.Play_Sounder(Frm_Main.CheckListBox.Items.Strings[Play_Index]);
         Frm_Main.CheckListBox.ItemIndex := Play_Index;
            if Frm_Main.List_Boot = True then
               Frm_List.CheckListBox.ItemIndex := Frm_Main.CheckListBox.ItemIndex;
    end;
if Frm_Main.Roundom_Play = False then
   begin
        if  Frm_Main.CheckListBox.ItemIndex >= 1 then
            Play_Index:=Frm_Main.CheckListBox.ItemIndex-1
            else
                Play_Index:=0;
                Frm_Main.Play_Sounder(Frm_Main.CheckListBox.Items.Strings[Play_Index]);
                Frm_Main.CheckListBox.ItemIndex := Play_Index;
                if Frm_Main.List_Boot = True then
                   Frm_List.CheckListBox.ItemIndex := Frm_Main.CheckListBox.ItemIndex;
   end;
except
     exit;
   end;
end;

procedure TFrm_Main.Sp_XiaClick(Sender: TObject);
begin
     Frm_Main.Menu_XiaPlay.Click;
end;

procedure TFrm_Main.Sp_ShangClick(Sender: TObject);
begin
     Frm_Main.Menu_ShangPlay.Click;
end;

procedure TFrm_Main.FormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
     Frm_Main.Caption := Frm_Main.Caption;
end;

procedure TFrm_Main.Image_bmpMouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
     Frm_Main.Mous_Down();
end;

procedure TFrm_Main.Image_bmpMouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
      Frm_Main.Mous_up();
end;

procedure TFrm_Main.Timer_MouseTimer(Sender: TObject);
var
     Temp_Point:TPoint;
begin
try
     if Frm_Main.Mouse_Down = True then
        begin
             Windows.GetCursorPos(Temp_Point);
             Frm_Main.left := Temp_Point.X-160;
             Frm_Main.top := Temp_Point.Y-100;
        end;
except
     exit;
   end;
end;

procedure TFrm_Main.Mous_Down;
begin
if Frm_Main.Move_OffOn = False then exit;

     Frm_Main.Mouse_Down := True;
     Frm_Main.Timer_Mouse.Enabled := True;
end;

procedure TFrm_Main.Mous_up;
begin
if Frm_Main.Move_OffOn = False then exit;

     Frm_Main.Mouse_Down := False;
     Frm_Main.Timer_Mouse.Enabled := False;
end;

procedure TFrm_Main.Panel_BiaoMouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
        Frm_Main.Mous_Down();
end;

procedure TFrm_Main.Panel_BiaoMouseUp(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
        Frm_Main.Mous_up();
end;

procedure TFrm_Main.Panel_JinDuMouseUp(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
        Frm_Main.Mous_up();
end;

procedure TFrm_Main.Panel_JinDuMouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
        Frm_Main.Mous_Down();
end;

procedure TFrm_Main.Panel_QuMuMouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
        Frm_Main.Mous_Down();
end;

procedure TFrm_Main.Panel_QuMuMouseUp(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
        Frm_Main.Mous_up();
end;

procedure TFrm_Main.Menu_MoveClick(Sender: TObject);
begin
     Frm_Main.Move_OffOn := True;
     Frm_Main.Menu_Move.Checked := True;
     Frm_Main.Menu_NoMove.Checked := False;
end;

procedure TFrm_Main.Menu_NoMoveClick(Sender: TObject);
begin
     Frm_Main.Move_OffOn := False;
     Frm_Main.Menu_Move.Checked := False;
     Frm_Main.Menu_NoMove.Checked := True;
end;

procedure TFrm_Main.Menu_EnglishClick(Sender: TObject);
begin
try
      Frm_Main.Menu_OpenS.Caption := 'Open single(&O)';
      Frm_Main.Menu_OpenM.Caption := 'Open many(&M)';
      Frm_Main.Menu_XiaPlay.Caption := 'Next(&N)';
      Frm_Main.Menu_ShangPlay.Caption :='Previous(&P)';
      Frm_Main.Menu_Exit.Caption := 'Exit(&E)';
      Frm_Main.Menu_OpenList.Caption :='Show ListBox';
      Frm_Main.Menu_ClostList.Caption :='Hide ListBox';
      Frm_Main.Menu_OpenWork.Caption :='Show Worker(&W)';
      Frm_Main.Menu_ClostWork.Caption :='Hide Worker';
      Frm_Main.Menu_Help.Caption :='Help(&H)';
      Frm_Main.Menu_FormTop.Caption :='StayOnTop';
      Frm_Main.Menu_Left.Caption := 'Left voice';
      Frm_Main.Menu_Model.Caption :='Balance voice';
      Frm_Main.Menu_Right.Caption :='Right voice';
      Frm_Main.Menu_SoundAdd.Caption := 'Add voice';
      Frm_Main.Menu_SoundDel.Caption := 'Delete voice';
      Frm_Main.Menu_MixWindow.Caption :='Windows Minimized';
      Frm_Main.Menu_CDOpen.Caption :='Open Cdrom';
      Frm_Main.Menu_CDClose.Caption :='Close Cdrom';
      Frm_Main.Menu_Pluse.Caption :='Pinouts';
      Frm_Main.Menu_FormNorml.Caption :='Windows Maximized';
      Frm_Main.Menu_SoundConf.Caption :='Sound Config';
      Frm_Main.Menu_Picture.Caption :='Form Picture';
      Frm_Main.Menu_SoundOffOn.Caption :='Voice on-off';
      Frm_Main.Menu_NoXuan.Caption :='Round Close';
      Frm_Main.Menu_XunHuan.Caption :='Round Open';
      Frm_Main.Menu_Play.Caption :='Play';
      Frm_Main.Menu_Pause.Caption := 'Pause';
      Frm_Main.Menu_Roundom.Caption :='Random Play';
      Frm_Main.Menu_ShunXu.Caption :='Order';
      Frm_Main.Menu_ZPPL.Caption :='One One Two';
      Frm_Main.Menu_DPPL.Caption :='One Two One';
      Frm_Main.Menu_YCPL.Caption :='One two three';
      Frm_Main.Menu_CDPL.Caption :='Top middle bottom';
      Frm_Main.Menu_Move.Caption :='Easy move';
      Frm_Main.Menu_NoMove.Caption :='Not move';
      Frm_Main.Menu_WinGuan.Caption :='Windows manage';
      Frm_Main.Menu_WinShun.Caption :='Windows order';
      Frm_Main.Menu_Sound.Caption :='Sound Configer';
      Frm_Main.Menu_StatePlay.Caption :='State play';
      Frm_Main.Menu_VCD.Caption :='VCD Player Setup';
      Frm_Main.Menu_VcdOpen.Caption :='Open VCD File';
      Frm_Main.Menu_VcdPause.Caption :='VCD Stop Play';
      Frm_Main.Menu_VcdPlay.Caption :='Goto Play File';
      Frm_Main.Menu_VcdFrowd.Caption :='Fwd 5 Seconds';
      Frm_Main.Menu_VcdBack.Caption := 'Back 5 Seconds';
      Frm_Main.Menu_VcdFull.Caption :='Play Full Screen';
      Frm_Main.Menu_VcdNorml.Caption :='Play In Windows';

      Frm_Main.Menu_English.Checked := True;
      Frm_Main.Menu_China.Checked := False;
except
     exit;
end;
end;

procedure TFrm_Main.Menu_ChinaClick(Sender: TObject);
begin
      Frm_Main.Menu_OpenS.Caption := '打开单个文件(&O)';
      Frm_Main.Menu_OpenM.Caption := '打开多个文件(&M)';
      Frm_Main.Menu_XiaPlay.Caption := '下一首歌(&N)';
      Frm_Main.Menu_ShangPlay.Caption :='上一首歌(&P)';
      Frm_Main.Menu_Exit.Caption := '关闭(&E)';
      Frm_Main.Menu_OpenList.Caption :='显示目录表';
      Frm_Main.Menu_ClostList.Caption :='隐藏目录表';
      Frm_Main.Menu_OpenWork.Caption :='显示作者信息(&W)';
      Frm_Main.Menu_ClostWork.Caption :='隐藏作者信息';
      Frm_Main.Menu_Help.Caption :='在线帮助(&H)';
      Frm_Main.Menu_FormTop.Caption :='窗口在最上方';
      Frm_Main.Menu_Left.Caption := '左声道';
      Frm_Main.Menu_Model.Caption :='平衡音';
      Frm_Main.Menu_Right.Caption :='右声音';
      Frm_Main.Menu_SoundAdd.Caption := '声音增加';
      Frm_Main.Menu_SoundDel.Caption := '声音减小';
      Frm_Main.Menu_MixWindow.Caption :='窗口最小化';
      Frm_Main.Menu_CDOpen.Caption :='打开光驱';
      Frm_Main.Menu_CDClose.Caption :='关闭光驱';
      Frm_Main.Menu_Pluse.Caption :='动画插件';
      Frm_Main.Menu_FormNorml.Caption :='窗口正常化';
      Frm_Main.Menu_SoundConf.Caption :='微软音量控制台';
      Frm_Main.Menu_Picture.Caption :='更改窗口壁纸';
      Frm_Main.Menu_SoundOffOn.Caption :='静音/恢复';
      Frm_Main.Menu_NoXuan.Caption :='单次播放';
      Frm_Main.Menu_XunHuan.Caption :='循环播放';
      Frm_Main.Menu_Play.Caption :='继续播放';
      Frm_Main.Menu_Pause.Caption := '暂停播放';
      Frm_Main.Menu_Roundom.Caption :='随机播放目录表';
      Frm_Main.Menu_ShunXu.Caption :='按顺序播放';
      Frm_Main.Menu_ZPPL.Caption :='正品字排序';
      Frm_Main.Menu_DPPL.Caption :='倒品字排序';
      Frm_Main.Menu_YCPL.Caption :='一次排开';
      Frm_Main.Menu_CDPL.Caption :='层叠排序';
      Frm_Main.Menu_Move.Caption :='容易移动';
      Frm_Main.Menu_NoMove.Caption :='不容易移动';
      Frm_Main.Menu_WinGuan.Caption :='窗口管理';
      Frm_Main.Menu_WinShun.Caption :='窗口排序';
      Frm_Main.Menu_Sound.Caption :='声音管理';
      Frm_Main.Menu_StatePlay.Caption :='播放状态';
      Frm_Main.Menu_VCD.Caption :='电影视频欣赏';
      Frm_Main.Menu_VcdOpen.Caption :='打开';
      Frm_Main.Menu_VcdPause.Caption :='暂停';
      Frm_Main.Menu_VcdPlay.Caption :='继续';
      Frm_Main.Menu_VcdFrowd.Caption :='前进';
      Frm_Main.Menu_VcdBack.Caption := '后退';
      Frm_Main.Menu_VcdFull.Caption :='全屏';
      Frm_Main.Menu_VcdNorml.Caption :='正常';

      Frm_Main.Menu_English.Checked := False;
      Frm_Main.Menu_China.Checked := True;
end;

procedure TFrm_Main.Menu_VcdOpenClick(Sender: TObject);
var
     Play_Size:TRect;
begin
try
      Frm_Main.DlgOpen_VCD.Title := Frm_Main.Caption;
      if Frm_Main.DlgOpen_VCD.Execute then
         begin
              Frm_Main.StopBtn.Click;
              
              Frm_Main.MediaPlayer.FileName := Frm_Main.DlgOpen_VCD.FileName;
              Frm_Main.MediaPlayer.Open;
           if Frm_Main.VCD_Play = False then
              begin
                  Frm_Play:=TFrm_Play.Create(self);
                  Frm_Play.Caption := Frm_Main.Caption;
                  Frm_Main.VCD_Play := True;
                  Frm_Play.show;
              end;
              Play_Size.Left :=0; Play_Size.Top :=0;
              Play_Size.Right := Frm_Play.Panel_Play.Width;
              Play_Size.Bottom := Frm_Play.Panel_Play.Height;
              Frm_Main.MediaPlayer.DisplayRect := Play_Size;
              Frm_Main.MediaPlayer.Display := Frm_Play.Panel_Play;

              Frm_Main.Length_Miao := Frm_Main.MediaPlayer.Length;
              Frm_Main.Length_Play :=0;
              Frm_Main.Play_Stop := True;
              Frm_Play.Timer_JinDu.Enabled := True;
              Frm_Main.Menu_VcdPause.Enabled := True;
              Frm_Main.Menu_VcdPlay.Enabled := True;
              Frm_Main.Menu_VcdFrowd.Enabled := True;
              Frm_Main.Menu_VcdBack.Enabled := True;
              Frm_Main.Menu_VcdFull.Enabled := True;
              Frm_Main.Menu_VcdNorml.Enabled := True;
              Frm_Main.Panel_Curent.Caption := IntToStr(Frm_Main.MediaPlayer.Length);
              Frm_Main.MediaPlayer.Play;
         end;
except
     exit;
end;
end;

procedure TFrm_Main.Menu_VcdPauseClick(Sender: TObject);
begin
try
     Frm_Main.MediaPlayer.Pause;
     Frm_Main.Play_Stop := False;

except
        exit;
end;
end;

procedure TFrm_Main.Menu_VcdPlayClick(Sender: TObject);
begin
try
     Frm_Main.MediaPlayer.Play;;
     Frm_Main.Play_Stop := True;

except
        exit;
end;
end;

procedure TFrm_Main.Menu_VcdFrowdClick(Sender: TObject);
begin
try
     Frm_Main.MediaPlayer.Pause;
     if Frm_Main.MediaPlayer.Position + Round(Frm_Main.MediaPlayer.Length * 0.05) <= Frm_Main.MediaPlayer.Length then
        Frm_Main.MediaPlayer.Position := Frm_Main.MediaPlayer.Position + Round(Frm_Main.MediaPlayer.Length *0.05);
        Frm_Main.MediaPlayer.Play;
except
        exit;
end;
end;

procedure TFrm_Main.Menu_VcdBackClick(Sender: TObject);
begin
try
     Frm_Main.MediaPlayer.Pause;
     if Frm_Main.MediaPlayer.Position - Round(Frm_Main.MediaPlayer.Length * 0.05) >= 0 then
        Frm_Main.MediaPlayer.Position := Frm_Main.MediaPlayer.Position - Round(Frm_Main.MediaPlayer.Length *0.05);
     Frm_Main.MediaPlayer.Play;
except
        exit;
end;
end;

procedure TFrm_Main.FormClose(Sender: TObject; var Action: TCloseAction);
begin
     Action:=CaFree;
end;

procedure TFrm_Main.Menu_VcdFullClick(Sender: TObject);
var
    Play_Size:TRect;
begin
     if Frm_Main.VCD_Full = False then
       begin
            Frm_Full:=TFrm_Full.Create(self);
            Frm_Main.VCD_Full := True;
       end;

              Play_Size.Left :=0; Play_Size.Top :=0;
              Play_Size.Right := Frm_Full.Panel_Full.Width;
              Play_Size.Bottom := Frm_Full.Panel_Full.Height;
              Frm_Main.MediaPlayer.DisplayRect := Play_Size;
              Frm_Main.MediaPlayer.Display := Frm_Full.Panel_Full;

            Frm_Full.Show;
end;

procedure TFrm_Main.Menu_VcdNormlClick(Sender: TObject);
begin
    if Frm_Main.VCD_Full = True then
       Frm_Full.Close;
end;

end.



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -