📄 main.~pas
字号:
end;
procedure TForm1.FormShow(Sender: TObject);
var nubint : array[0..9] of integer;
i, Avgint, gsavg : integer;
begin
DBGridEh1.DataSource:=nil;
for i:=0 to 9 do nubint[i]:=0;
Avgint :=0;
gsavg :=0;
with AdoQuery1 do begin
Close;
SQL.Clear;
SQL.Add('select * from CPList order by 期数 desc');
Open;
Label3.Caption:=inttostr(RecordCount);
while not Eof do
begin
for i:=0 to 9 do
if fieldbyname(inttostr(i)).asstring<>'' then
nubint[i]:= nubint[i]+StrToInt(fieldbyname(inttostr(i)).asstring);
Avgint :=Avgint+strtoint(fieldbyname('总和').asstring);
gsavg :=gsavg+strtoint(fieldbyname('个数').asstring);
NEXT;
end;
first;
end;
DBGridEh1.DataSource:=DataSource1;
Label15.Caption := inttostr(Avgint div strtoint(Label3.Caption));
Label17.Caption := inttostr(gsavg div strtoint(Label3.Caption));
for i:=0 to 9 do
begin
TLabel(FindComponent('Lb'+inttostr(i))).Caption:=inttostr(nubint[i]);
TLabel(FindComponent('Lb'+inttostr(i))).Left:= TLabel(FindComponent('Bar'+inttostr(i))).Left+nubint[i]*2+2;
TsuiProgressBar(FindComponent('Bar'+inttostr(i))).Width:=nubint[i]*2;
end;
{Lb0.Caption:=inttostr(nubint[0]);
Lb0.Left:= Bar1.Left+nubint[0]+2;
Bar0.Width:=nubint[0]; }
end;
procedure TForm1.bsSkinButton2Click(Sender: TObject);
begin
if messagebox(0,'您确定要删除吗?','提示',mb_iconquestion or mb_yesno) = id_yes then
begin
RzEdit2.Text:= AdoQuery1.fieldbyname('期数').asstring;
RzEdit1.Text:= AdoQuery1.fieldbyname('中奖号码').asstring;
AdoQuery1.Delete;
end;
end;
procedure TForm1.DBGridEh1DrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumnEh;
State: TGridDrawState);
var i : integer;
begin
inherited;
with DBGrideh1 do
begin
if ((State = [gdSelected]) or (State=[gdSelected,gdFocused])) then
begin
Canvas.Font.Color :=ClYellow; //焦点颜色
Canvas.Brush.Color :=$00BA0000;
end
else
begin
if (Rect.Top = CellRect(Col,Row).Top) and (not (gdFocused in State) or not Focused) then
Canvas.Brush.Color :=$00BAF8FE;//$00FED994;
for i:=0 to 9 do
begin
if (ADOQuery1.fieldbyname(IntToStr(i)).AsString<>'')and(Column.FieldName=IntToStr(i)) then //要改颜色的字段
If StrToInt(ADOQuery1.fieldbyname(IntToStr(i)).AsString)>=2 then //条件
begin
Canvas.Font.Color := clred;
// Canvas.Brush.Color :=$00E8E8E8
Canvas.Font.Style :=[fsBold];
end;
if (Column.FieldName=IntToStr(i)) then
if ADOQuery1.fieldbyname(IntToStr(i)).AsString='' then
Canvas.Brush.Color :=$007CE4C6;
end;
end;
DefaultDrawColumnCell(Rect, DataCol, Column, State);
end;
end;
procedure TForm1.bsSkinButton3Click(Sender: TObject);
begin
CLOSE;
end;
procedure TForm1.DBGridEh1TitleBtnClick(Sender: TObject; ACol: Integer;
Column: TColumnEh);
var sstr : string;
begin
case Column.Title.SortMarker of
smNoneEh: sstr:=' ORDER BY '+ Column.FieldName;
smDownEh: sstr:=' ORDER BY '+ Column.FieldName + ' DESC';
smUpEh: sstr:=' ORDER BY '+ Column.FieldName;
end;
with ADOQuery1 do
begin
Close;
sql.clear;
sql.Add('select * from CPList '+sstr);
open;
end;
end;
procedure TForm1.DataSource1DataChange(Sender: TObject; Field: TField);
begin
// if TDataSource(Sender).DataSet.Eof then TDataSource(Sender).DataSet.Cancel;
end;
// 产生随机数 /****************************************************
procedure TForm1.bsSkinButton4Click(Sender: TObject);
var i : integer;
begin
for i:=1 to RzSpinEdit1.IntValue do
begin
if RzCheckBox3.Checked then
GetLuckNub()
else
GetGoodNub();
God1.Update;
God2.Update;
God3.Update;
God4.Update;
God5.Update;
God6.Update;
God7.Update;
sleep(49);
end;
end;
procedure TForm1.GetLuckNub(); // 取幸运号
var i, j : integer;
s,ss : string;
begin
if length(trim(RzEdit3.text))=0 then exit;
s:='';
Randomize;
for j:=length(ss) to 6 do
begin
i:=random(length(RzEdit3.text));
s:= copy(RzEdit3.text,i,1);
if trim(s)<>'' then
begin
TRzNumericEdit(FindComponent('God'+inttostr(j+1))).text:=s;
ss :=ss+s;
end;
end;
ss := God1.Text+God2.Text+God3.Text+God4.Text+God5.Text+God6.Text+God7.Text;
RzMemo1.Lines.Add(ss);
end;
procedure TForm1.GetGoodNub();
var i : integer;
s : string;
begin
s :='';
if date()<strtodate('2005-07-01') then
Randomize;
for i:=1 to 7 do
begin
if RzCheckBox1.Checked then // 大小
if TsuiCheckBox(FindComponent('DXCB'+inttostr(i))).Checked then
StrOdd(random(5)+5,i)
else
StrOdd(random(5),i)
else
if RzCheckBox2.Checked then
StrOdd(random(10),i)
else
TRzNumericEdit(FindComponent('God'+inttostr(i))).Text:=inttostr(random(10));
s :=s+TRzNumericEdit(FindComponent('God'+inttostr(i))).Text;
end;
RzMemo1.Lines.Add(s);
end;
//----------------------------------------------------------------------------//
procedure TForm1.StrOdd(i, j : integer); // 奇偶
begin
if RzCheckBox2.Checked then
begin
if TsuiCheckBox(FindComponent('QoCb'+inttostr(j))).Checked then
begin
if odd(i) then
TRzNumericEdit(FindComponent('God'+inttostr(j))).Text:=inttostr(i)
else
if i=9 then
TRzNumericEdit(FindComponent('God'+inttostr(j))).text:=inttostr(i-1)
else
TRzNumericEdit(FindComponent('God'+inttostr(j))).text:=inttostr(i+1)
end else begin
if odd(i) then
if i=9 then
TRzNumericEdit(FindComponent('God'+inttostr(j))).text:=inttostr(i-1)
else
TRzNumericEdit(FindComponent('God'+inttostr(j))).text:=inttostr(i+1)
else
TRzNumericEdit(FindComponent('God'+inttostr(j))).text:=inttostr(i)
end;
end else
TRzNumericEdit(FindComponent('God'+inttostr(j))).text:=inttostr(i);
end;
procedure TForm1.RzCheckBox1Click(Sender: TObject);
begin
if RzCheckBox1.Checked then
begin
DXCB1.Enabled:=true;
DXCB2.Enabled:=true;
DXCB3.Enabled:=true;
DXCB4.Enabled:=true;
DXCB5.Enabled:=true;
DXCB6.Enabled:=true;
DXCB7.Enabled:=true;
end else begin
DXCB1.Enabled:=false;
DXCB2.Enabled:=false;
DXCB3.Enabled:=false;
DXCB4.Enabled:=false;
DXCB5.Enabled:=false;
DXCB6.Enabled:=false;
DXCB7.Enabled:=false;
end;
end;
procedure TForm1.RzCheckBox2Click(Sender: TObject);
begin
if RzCheckBox2.Checked then
begin
QoCb1.Enabled:=true;
QoCb2.Enabled:=true;
QoCb3.Enabled:=true;
QoCb4.Enabled:=true;
QoCb5.Enabled:=true;
QoCb6.Enabled:=true;
QoCb7.Enabled:=true;
end else begin
QoCb1.Enabled:=false;
QoCb2.Enabled:=false;
QoCb3.Enabled:=false;
QoCb4.Enabled:=false;
QoCb5.Enabled:=false;
QoCb6.Enabled:=false;
QoCb7.Enabled:=false;
end;
end;
procedure TForm1.RzMemo1DblClick(Sender: TObject);
begin
RzMemo1.Lines.Clear;
end;
procedure TForm1.bsSkinButton5Click(Sender: TObject);
var i : integer;
s : string;
begin
Randomize;
i:=random(128);
s := IntPartToBin(i);
for i:=length(s) to 6 do
s :='0'+ s;
for i:=1 to 7 do
begin
if copy(s,i,1)='1' then
TsuiCheckBox(FindComponent('DXCb'+inttostr(i))).Checked:=true
else
TsuiCheckBox(FindComponent('DXCb'+inttostr(i))).Checked:=false;
end;
end;
procedure TForm1.bsSkinButton6Click(Sender: TObject);
var i : integer;
s : string;
begin
Randomize;
i:=random(128);
s := IntPartToBin(i);
for i:=length(s) to 6 do
s :='0'+ s;
for i:=1 to 7 do
begin
if copy(s,i,1)='1' then
TsuiCheckBox(FindComponent('QoCb'+inttostr(i))).Checked:=true
else
TsuiCheckBox(FindComponent('QoCb'+inttostr(i))).Checked:=false;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -