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

📄 unit1.pas

📁 delphi写的抽奖程序
💻 PAS
字号:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, ExtCtrls, jpeg,inifiles, MPlayer;

type
  TForm1 = class(TForm)
    Image1: TImage;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    BitBtn3: TBitBtn;
    Mp1: TMediaPlayer;
    mp2: TMediaPlayer;
    procedure BitBtn1Click(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
    procedure BitBtn3Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure sou;
    procedure souClear;
    Procedure souplay;
    Procedure Souendplay;
    procedure FormCreate(Sender: TObject);
    procedure Mp1Notify(Sender: TObject);
    procedure mp2Notify(Sender: TObject);
  private
    { Private declarations }
  public
    SysPath:string;
    sou1,sou2,sou3,sou4,sou5,re1,re2,re3:integer;
    opt2:integer;
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses Unit2,Unit4, Unit8,Unit5;

{$R *.dfm}

procedure TForm1.BitBtn1Click(Sender: TObject);
begin
  form2.ShowModal;
end;

procedure TForm1.BitBtn2Click(Sender: TObject);
begin
  opt2:=1;
  mp1.Stop;
  form4.Show;
  form1.Hide; 
end;

procedure TForm1.BitBtn3Click(Sender: TObject);
begin
  form5.ShowModal;
end;

procedure TForm1.FormShow(Sender: TObject);
begin
  if dm.ADOC1.Connected=false then
  begin
    //dm.ADOC1.ConnectionString:='Provider=SQLOLEDB.1;Password=051009;Persist Security Info=True;User ID=sa;Initial Catalog=choujiang;Data Source=(local)';
    dm.ADOC1.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Data\choujiang.mdb;Persist Security Info=False';
    dm.ADOC1.Connected:=true;
    dm.ADOQ2.Active:=true;
    dm.ADOQ4.Active:=true;
    dm.ADOQ7.Active:=true;
    dm.ADOQ9.Active:=true;
    dm.ADOQ12.Active:=true;
    dm.ADOQ13.Active:=true;
  end;
  SysPath:=ExtractFilePath(Application.ExeName);
  form1.souClear;
  form1.sou;
  form1.souplay;
end;

procedure TForm1.sou;
var iniinfo:Tinifile;
begin
  iniinfo:=Tinifile.Create(form1.SysPath +'Config.ini');
  Try
  if strtoint(iniinfo.ReadString('Souns','AllO','0'))=0 then
  begin
    form1.sou1:=1;
    form1.sou2:=1;
    form1.sou3:=1;
    form1.sou4:=1;
    form1.sou5:=1;
    form1.re1:=1;
    form1.re2:=1;
    form1.re3:=1;
    exit;
  end;
  if strtoint(iniinfo.ReadString('Souns','open11','1'))=0 then
  begin
    form1.sou1:=0;
    form1.sou2:=0;
    form1.sou3:=0;
    form1.sou4:=0;
    form1.sou5:=0;
  end;
  if strtoint(iniinfo.ReadString('Souns','open01','0'))=0 then
  begin
    form1.sou1:=0;
  end;
  if strtoint(iniinfo.ReadString('Souns','open02','0'))=0 then
  begin
    form1.sou2:=0;
  end;
  if strtoint(iniinfo.ReadString('Souns','open03','0'))=0 then
  begin
    form1.sou3:=0;
  end;
  if strtoint(iniinfo.ReadString('Souns','open04','0'))=0 then
  begin
    form1.sou4:=0;
  end;
  if strtoint(iniinfo.ReadString('Souns','open05','0'))=0 then
  begin
    form1.sou5:=0;
  end;
  if strtoint(iniinfo.ReadString('Souns','open06','0'))=0 then
  begin
    form1.re1:=0;
  end;
  if strtoint(iniinfo.ReadString('Souns','open07','0'))=0 then
  begin
    form1.re2:=0;
  end;
  if strtoint(iniinfo.ReadString('Souns','open08','0'))=0 then
  begin
    form1.re3:=0;
  end;
  finally
    freeandnil(iniinfo);
  end;
end;

procedure TForm1.souClear;
begin
  form1.sou1:=1;
  form1.sou2:=1;
  form1.sou3:=1;
  form1.sou4:=1;
  form1.sou5:=1;
  form1.re1:=1;
  form1.re2:=1;
  form1.re3:=1;
end;

procedure TForm1.Souendplay;
begin
  if ((form1.sou2=0) and (opt2=0)) then
  begin
    mp2.Play;
  end
  else
  begin
    mp2.Stop;
  end;
end;

procedure TForm1.souplay;
begin
  if ((form1.sou1=0) and (opt2=1)) then
  begin
    mp1.Play;
  end
  else
  begin
    mp1.Stop;
  end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  opt2:=1;
end;

procedure TForm1.Mp1Notify(Sender: TObject);
begin
{  if ((form1.re1=0) and (form1.sou1=0) and (opt2=1)) then
  begin
    if mp1.Mode=mpstopped then
    begin
      mp1.Play;
    end;
  end;   }
end;

procedure TForm1.mp2Notify(Sender: TObject);
begin
 { if ((form1.re2=0) and (form1.sou2=0) and(opt2=0))  then
  begin
    if mp2.Mode=mpstopped then
    begin
      mp2.Play;
    end;
  end;   }
end;

end.

⌨️ 快捷键说明

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