📄 form_redfenxil.pas
字号:
grid1.Cells[1,grid1.RowCount-1].ForeText:='预测';
grid1.Cells[1,grid1.RowCount-1].Color:=rgb(0,255,0);
for i:=2 to 34 do
begin
grid1.Cells[i,grid1.RowCount-1].Color:=rgb(255,255,0);
grid1.cells[i,grid1.RowCount-1].foretext:=inttostr(i-1);
end;
/////为35,36,37,38,39列添加颜色///////////////////
for i:=1 to grid1.RowCount-1 do
begin
grid1.Cells[35,i].Color:=rgb(233,240,210);
grid1.Cells[36,i].Color:=rgb(245,245,245);
grid1.Cells[37,i].Color:=rgb(245,245,245);
grid1.Cells[38,i].Color:=rgb(245,245,245);
grid1.Cells[39,i].Color:=rgb(245,245,245);
//grid1.Cells[34,i].Color:=rgb(233,240,210);
end;
///////计算和值//////////////////////////////////////
{with AdoQuery1 do
begin
connectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+CurrentPath+'\sale.mdb;Persist Security Info=False';
close;
sql.Clear;
sql.Add('Select * From CPSdata Where sID>=:sb and sId<=:se order By sID');
parameters.ParamByName('sb').Value:=trim(s_BeginID);
parameters.ParamByName('se').Value:=trim(s_EndID);
prepared;
open;
if RecordCount<>0 then
begin
i:=1;
while not Eof do
begin
Grid1.Cells[35,i+1].ForeText:=trim(FieldByName('CP_Sum').AsString);
Grid1.Cells[36,i+1].ForeText:=trim(FieldByName('CP_Odd').AsString)+':'+trim(formatFloat('##0',(7-strToInt(trim(FieldByName('CP_Odd').AsString)))));
Grid1.Cells[37,i+1].ForeText:=trim(FieldByName('CP_Area1').AsString)+':'+trim(FieldByName('CP_Area2').AsString)+':'+trim(FieldByName('CP_Area3').AsString);
Grid1.Cells[39,i+1].ForeText:=trim(FieldByName('CP_Large').AsString)+':'+trim(formatFloat('##0',(7-strToInt(trim(FieldByName('CP_Large').AsString)))));
next;
inc(i);
end;//while
end;//if
end;//with
}
//////////计算和值//////////////////////////////////////
for i:=2 to grid1.RowCount-2 do
begin
_Sum:=0;
for j:=1 to 6 do
begin
_Sum:=_Sum+CP_Data[i-1,j];
end;///for j
grid1.Cells[35,i].ForeText:=formatFloat('##0',_Sum);
end;//for i
///////给和值>102的数值添加颜色//////////////////////////
for i:=2 to grid1.RowCount-2 do
begin
if strToInt(grid1.cells[35,i].foretext)>=102 then
begin
grid1.Cells[35,i].Color:=rgb(220,120,120);
end;///
end;///
/////////计算奇偶比例///////////////////////////////////
_OddNum:=TStringList.Create;
for i:=2 to grid1.RowCount-2 do
begin
_OddNum.Clear;
for j:=1 to 6 do
begin
if (CP_Data[i-1,j] mod 2)=1 then
begin
_OddNum.Add(IntToStr(CP_Data[i-1,j]));
end;///
end;//forj
grid1.Cells[36,i].ForeText:=trim(IntToStr(_OddNum.Count))+':'+trim(IntToStr((6-_OddNum.Count)));
end;//for i
////////计算区域比例///////////////////////////////////
_Area1:=TStringList.Create;
_Area2:=TStringList.Create;
_Area3:=TStringList.Create;
for i:=2 to grid1.RowCount-2 do
begin
_Area1.Clear;
_Area2.Clear;
_Area3.Clear;
for j:=1 to 6 do
begin
if (CP_Data[i-1,j]<12) then
begin
_Area1.Add(IntToStr(CP_Data[i-1,j]));
end;///
if (CP_Data[i-1,j]>11) and (CP_Data[i-1,j]<23) then
begin
_Area2.Add(IntToStr(CP_Data[i-1,j]));
end;///
if (CP_Data[i-1,j]>22) then
begin
_Area3.Add(IntToStr(CP_Data[i-1,j]));
end;///
end;//forj
grid1.Cells[37,i].ForeText:=trim(IntToStr(_Area1.Count))+':'+trim(IntToStr(_Area2.Count))+':'+trim(IntToStr(_Area3.Count));
end;//for i
//////计算大小比例///////////////////////////////////////
_Large:=TStringList.Create;
for i:=2 to grid1.RowCount-2 do
begin
_Large.Clear;
for j:=1 to 6 do
begin
if (CP_Data[i-1,j])>16 then
begin
_Large.Add(IntToStr(CP_Data[i-1,j]));
end;///
end;//forj
grid1.Cells[39,i].ForeText:=trim(IntToStr(_Large.Count))+':'+trim(IntToStr((6-_Large.Count)));
end;//for i
///////计算除3余数(余1:余2;余0)比例///////////////////
_Div_1:=TStringList.Create;
_Div_2:=TStringList.Create;
_Div_3:=TStringList.Create;
for i:=2 to grid1.RowCount-2 do
begin
_Div_1.Clear;
_Div_2.Clear;
_Div_3.Clear;
for j:=1 to 6 do
begin
if (CP_Data[i-1,j] mod 3)=1 then
begin
_Div_1.Add(IntToStr(CP_Data[i-1,j]));
end;///
if (CP_Data[i-1,j] mod 3)=2 then
begin
_Div_2.Add(IntToStr(CP_Data[i-1,j]));
end;///
if (CP_Data[i-1,j] mod 3)=0 then
begin
_Div_3.Add(IntToStr(CP_Data[i-1,j]));
end;///
end;//forj
grid1.Cells[38,i].ForeText:=trim(IntToStr(_Div_1.Count))+':'+trim(IntToStr(_Div_2.Count))+':'+trim(IntToStr(_Div_3.Count));
end;//for i
/////////对奇偶,大小等突出的用特殊颜色///////////////
//////对奇偶比特殊的用绿色表示/////////////////////////
for i:=2 to grid1.RowCount-2 do
begin
if (grid1.Cells[36,i].ForeText='1:5') or (grid1.Cells[36,i].ForeText='5:1') or (grid1.Cells[36,i].ForeText='0:6') or (grid1.Cells[36,i].ForeText='6:0') then
begin
grid1.Cells[36,i].Color:=rgb(0,255,0);
end;//if
_TmpB:=trim(grid1.Cells[37,i].ForeText);
if (_TmpB='0:2:4') or (_TmpB='0:4:2') or (_TmpB='0:3:3') or (_TmpB='0:1:5') or (_TmpB='0:5:1') or (_TmpB='2:4:0') or (_TmpB='2:0:4') or (_TmpB='3:3:0') or (_TmpB='3:0:3') or (_TmpB='1:5:0') or (_TmpB='1:0:5') or (_TmpB='4:2:0') or (_TmpB='4:0:2') or (_TmpB='5:1:0') or (_TmpB='5:0:1') then
begin
grid1.Cells[37,i].Color:=rgb(190,192,110);
end;//if
_TmpC:=trim(grid1.Cells[38,i].ForeText);
if (_TmpC='0:2:4') or (_TmpC='0:4:2') or (_TmpC='0:3:3') or (_TmpC='0:1:5') or (_TmpC='0:5:1') or (_TmpC='2:4:0') or (_TmpC='2:0:4') or (_TmpC='3:3:0') or (_TmpB='3:0:3') or (_TmpC='1:5:0') or (_TmpC='1:0:5') or (_TmpC='4:2:0') or (_TmpC='4:0:2') or (_TmpC='5:1:0') or (_TmpC='5:0:1') then
begin
grid1.Cells[38,i].Color:=rgb(200,112,220);
end;//if
_TmpD:=trim(grid1.Cells[39,i].ForeText);
if (_TmpD='0:6') or (_TmpD='1:5') or (_TmpD='5:1') or (_TmpD='6:0') then
begin
grid1.Cells[39,i].Color:=rgb(0,255,110);
end;///uif
end;//
///////////2007.5.5设置表格grid3的///////////////////////////////////////////////////////////////
grid3.RowCount:=grid1.RowCount;
grid3.ColWidths[1]:=45;
grid3.Cells[1,1].ForeText:='期号';
grid3.RowHeights[1]:=20;
for i:=2 to 34 do
begin
grid3.ColWidths[i]:=20;
grid3.cells[i,1].foretext:=inttostr(i-1);
grid3.cells[i,grid3.RowCount-1].foretext:=inttostr(i-1);
end;
for i:=2 to 34 do
begin
grid3.Cells[i,1].Color:=rgb(255,255,0);
grid3.Cells[i,grid3.RowCount-1].Color:=rgb(255,255,0);
end;///// fotr
for i:=2 to grid3.RowCount-1 do
begin
grid3.Cells[1,i].Color:=rgb(58,110,165);
end;////for i
for i:=2 to grid3.RowCount-2 do
begin
grid3.cells[1,i].ForeText:=grid1.cells[1,i].ForeText;
end;
///////显示双色球记录////////////////////
with AdoQuery1 do
begin
connectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+CurrentPath+'\sale.mdb;Persist Security Info=False';
close;
sql.Clear;
sql.Add('Select * From CPdata Where sID>=:sb and sID<=:se order By sID');
parameters.ParamByName('sb').Value:=trim(s_BeginId);
parameters.ParamByName('se').Value:=trim(s_EndId);
prepared;
open;
if recordcount<>0 then
begin
i:=1;
while not Eof do
begin
//grid3.RowCount:=i+2;
//Canvas.Brush.Color:=rgb(255,0,0);
//Canvas.FillRect(grid1.CellRect(strToInt(trim(FieldByName('r1').AsString))+1,i+1));
///grid1.Cells[1,i+1].ForeText:=trim(FieldByName('sID').AsString);
/////(球1)/////////
///grid1.Cells[strToInt(trim(FieldByName('r1').AsString))+1,i+1].ForeText:=trim(FieldByName('r1').AsString);
/////////
grid3.Cells[strToInt(trim(FieldByName('r1').AsString))+1,i+1].ForeText:=trim(FieldByName('r1').AsString);
/////////将红球号码存储在数组中//////////////////////////
//CP_Data[i,1]:=strToInt(trim(FieldByName('r1').AsString));
/////(球2)/////////
//grid1.Cells[strToInt(trim(FieldByName('r2').AsString))+1,i+1].ForeText:=trim(FieldByName('r2').AsString);
/////////
grid3.Cells[strToInt(trim(FieldByName('r2').AsString))+1,i+1].ForeText:=trim(FieldByName('r2').AsString);
/////////将红球号码存储在数组中//////////////////////////
///CP_Data[i,2]:=strToInt(trim(FieldByName('r2').AsString));
/////(球3)/////////
//grid1.Cells[strToInt(trim(FieldByName('r3').AsString))+1,i+1].ForeText:=trim(FieldByName('r3').AsString);
grid3.Cells[strToInt(trim(FieldByName('r3').AsString))+1,i+1].ForeText:=trim(FieldByName('r3').AsString);
//CP_Data[i,3]:=strToInt(trim(FieldByName('r3').AsString));
/////(球4)////////////
///grid1.Cells[strToInt(trim(FieldByName('r4').AsString))+1,i+1].ForeText:=trim(FieldByName('r4').AsString);
grid3.Cells[strToInt(trim(FieldByName('r4').AsString))+1,i+1].ForeText:=trim(FieldByName('r4').AsString);
///CP_Data[i,4]:=strToInt(trim(FieldByName('r4').AsString));
/////(球5)////////////
///grid1.Cells[strToInt(trim(FieldByName('r5').AsString))+1,i+1].ForeText:=trim(FieldByName('r5').AsString);
grid3.Cells[strToInt(trim(FieldByName('r5').AsString))+1,i+1].ForeText:=trim(FieldByName('r5').AsString);
///CP_Data[i,5]:=strToInt(trim(FieldByName('r5').AsString));
/////(球6)////////////
////grid1.Cells[strToInt(trim(FieldByName('r6').AsString))+1,i+1].ForeText:=trim(FieldByName('r6').AsString);
grid3.Cells[strToInt(trim(FieldByName('r6').AsString))+1,i+1].ForeText:=trim(FieldByName('r6').AsString);
////CP_Data[i,6]:=strToInt(trim(FieldByName('r6').AsString));
/// CP_Data[i,7]:=strToInt(trim(FieldByName('b1').AsString));
//grid1.Canvas.Brush.Color:=rgb(0,0,0);
//grid1.Canvas.FillRect(grid1.CellRect(strToInt(trim(FieldByName('r1').AsString))+1,i+1));
next;
inc(i);
end;///while
end;//if
end;//with
/////////2007.5.5设置表格 grid3///////////////////////////////////////////////////////////////////
/////取得最大的期号/////////////////////////
///////////////////////////////////////////////////////
grid1.Refresh;
///////////////////////////////////////////////////////
end;
procedure TForm_RedFenXi.Image2Click(Sender: TObject);
begin
CloseForm(handle)
end;
procedure TForm_RedFenXi.TabCtrlDrawTab(Control: TCustomTabControl;
TabIndex: Integer; const Rect: TRect; Active: Boolean);
var
TabTitle:Array[0..50] of string;
begin
TabTitle[0]:='红球分布图';
TabTitle[1]:='号码走势图';
TabTitle[2]:='行列分布图';
TabTitle[3]:='和值分析';
TabTitle[4]:='尾数走势';
TabTitle[5]:='尾和分析';
TabTitle[6]:='号码特征图';
TabTitle[7]:='区域比分析';
TabTitle[8]:='间隔分析图';
TabTitle[9]:='遗漏分析表';
with Control.Canvas do
begin
if active then
begin
Font.Color:=clRed;
Font.Name:='宋体';
Font.Size:=10;
end
else
begin
Font.Style:=[];
Font.Name:='宋体';
Font.Size:=10;
end;
TextRect(Rect,Rect.Left+20,Rect.Top+3,TabTitle[TabIndex]);////输出标题
ImageList1.Draw(Control.Canvas,Rect.Left+2,Rect.Top+2,TabIndex);///画图标
end;///with
end;
procedure TForm_RedFenXi.TabCtrlChange(Sender: TObject);
var
R_CpData1:Array[1..6,0..100] of integer; ////存储彩票数据的/////
R_CPID:Array[0..100] of string;////存储各期彩票的期号/////
R_CpData2:Array[1..100] of integer;
R_CpData3:Array[1..100] of integer;
R_CpData4:Array[1..100] of integer;
R_CpData5:Array[1..100] of integer;
R_CpData6:Array[1..100] of integer;
R_CpData7:Array[1..100] of integer;
FieldIndex:string; ////存储彩票字段索引/////////
CurrentPath:string;/////存储当前数据库的路径
strSql:string; /////存储临时sql语句///////////
R_CPTotal:Array[1..100] of integer;/////存储和值///////////////////
R_CPTotalSub:Array[1..100] of integer;////存储和值之间的差值1///////////
R_CPTotalSub1:Array[1..100] of integer;////存储和值之间的差值2
R_CPLastNumber:Array[1..6,1..100] of integer;////存储尾数//////////
R_CPLastNumber1:Array[1..6,1..100] of integer;////存储尾数1//////////
R_CPLastNumberTotal:Array[1..100] of integer;////存储尾数和//////////
R_CPLastTotalSub:Array[1..100] of integer;/////存储尾数和之间的差///////
R_CPLastTotalSub1:Array[1..100] of integer;/////存储尾数和之间的差///////
i:integer;
j,x:integer;
w:integer;
sBeginID:string;
sEndID:string;
///////////
OddNumber:TStringList;////存储奇数个数
OddNumberCount:TStringList;
//////////
PrimeNumber:TStringList;////存储质数个数
PrimeNumberCount:TStringList;
//////////
BigNumber:TStringList;//////存储大数个数
BigNumberCount:TStringList;
///////////
LastNumber:TStringList;////存储尾数个数/////////
LastNumberCount:TStringList;
////存储和值尾数///////////////////
TotalLastNum:Array[1..50] of integer;
TotalLastNumSub:Array[1..50] of integer;
begin
CurrentPath:=ExtractFilePath(paramStr(0));
sBeginID:=s_BeginID;
sEndID:=s_EndID;
///////TabCtrl.index=0是红球分布图///////////////////////////////////////
if TabCtrl.TabIndex=0 then
begin
end;///TabCtrl.index=0//////////
///////TabCtrl.index=0结束/////////////////////////////////////
///////TabCtrl.TabIndex=1号码走势图/////////////////////////
if TabCtrl.TabIndex=1 then
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -