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

📄 unit1.pas

📁 双色球生成
💻 PAS
字号:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, xpButton, xpBitBtn, ExtCtrls, xpWindow;

type
  TForm1 = class(TForm)
    Memo1: TMemo;
    Edit1: TEdit;
    xpBitBtn1: TxpBitBtn;
    xpButton1: TxpButton;
    Timer1: TTimer;
    xpWindow1: TxpWindow;

    procedure FormShow(Sender: TObject);
    procedure xpBitBtn1Click(Sender: TObject);
    procedure xpButton1Click(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}
var
aa : array[1..33] of string[2];
procedure TForm1.FormShow(Sender: TObject);
var
  i:integer;
begin
  for i:=1 to 33 do begin
    aa[i]:=inttostr(i);
  end;
end;

procedure TForm1.xpBitBtn1Click(Sender: TObject);
begin
   if xpbitbtn1.Caption='生 成' then
    begin
    xpbitbtn1.Caption:='停 止';
    timer1.Enabled:=true;
    randomize;
    end
   else
    begin
    timer1.Enabled:=false;
    xpbitbtn1.Caption:='生 成';
    end;
end;

procedure TForm1.xpButton1Click(Sender: TObject);
begin
   close;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
var
  a,i,j:integer;
  swapa:string[2];
begin
//  randomize;
  for i:=1 to 33 do begin
    j:=1+random(33);
    swapa:=aa[i];
    aa[i]:=aa[j];
    aa[j]:=swapa;
  end;
  a:=random(16);
  while (a=0) do
   begin
     a:=random(16);
   end;
  Edit1.Text:=inttostr(a);
  memo1.Text:=aa[1]+'   '+aa[2]+'   '+aa[3]+'   '+aa[4]+'   '+aa[5]+'   '+aa[6];

end;

end.

⌨️ 快捷键说明

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