📄 u_draw.~pas
字号:
begin
iPerUnit1:=strToInt(formatFloat('##0',iTop+(i)*(iHeight/Rows)));
moveTo(iLeft,iPerUnit1);
LineTo(iwidth+iLeft,iPerUnit1);
PointY[i+1]:=strToInt(formatFloat('##0',iTop+(i)*(iHeight/Rows)));
end;//forirows
////存储表格的坐标//////////
brush.Color:=rgb(255,0,0);
pen.Color:=rgb(255,0,0);
//////取得数据库数据////////////
CurrentPath:=ExtractFilePath(paramstr(0));
//Ellipse(rect(PointX[1],PointY[1],PointX[1]+strToInt(formatFloat('##0',(iHeight/Rows))),PointY[1]+strToInt(formatFloat('##0',(iWidth/cols)))));
//brush.Color:=rgb(255,255,255);
for i:=1 to 6 do
begin
with DataM.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=:sID');
parameters.ParamByName('sID').Value:=s_ID;
prepared;
open;
if RecordCount<>0 then
begin
FieldIndex:='R'+InttoStr(i);
R_CPData[1,i]:=FieldByName(FieldIndex).AsInteger;
end;//if
end;//with
end;///
for i:=1 to 6 do
begin
for j:=1 to 33 do
begin
if R_CPData[1,i]=j then
begin
case R_CPData[1,i] of
1..5:
Ellipse(rect(PointX[1],PointY[j],PointX[1]+strToInt(formatFloat('##0',(iHeight/Rows))),PointY[j]+strToInt(formatFloat('##0',(iWidth/cols)))));
11..15:
begin
x:=j-10;
Ellipse(rect(PointX[2],PointY[x],PointX[2]+strToInt(formatFloat('##0',(iHeight/Rows))),PointY[x]+strToInt(formatFloat('##0',(iWidth/cols)))));
end;
21..25:
begin
x:=j-20;
Ellipse(rect(PointX[3],PointY[x],PointX[3]+strToInt(formatFloat('##0',(iHeight/Rows))),PointY[x]+strToInt(formatFloat('##0',(iWidth/cols)))));
end;
31..35:
begin
x:=j-30;
Ellipse(rect(PointX[4],PointY[x],PointX[4]+strToInt(formatFloat('##0',(iHeight/Rows))),PointY[x]+strToInt(formatFloat('##0',(iWidth/cols)))));
end;
6..10:
begin
//showmessage('aaaa');
x:=j-5;
Ellipse(rect(PointX[5],PointY[x],PointX[5]+strToInt(formatFloat('##0',(iHeight/Rows))),PointY[x]+strToInt(formatFloat('##0',(iWidth/cols)))));
end;
16..20:
begin
x:=j-15;
Ellipse(rect(PointX[6],PointY[x],PointX[6]+strToInt(formatFloat('##0',(iHeight/Rows))),PointY[x]+strToInt(formatFloat('##0',(iWidth/cols)))));
end;
26..30:
begin
x:=j-25;
Ellipse(rect(PointX[7],PointY[x],PointX[7]+strToInt(formatFloat('##0',(iHeight/Rows))),PointY[x]+strToInt(formatFloat('##0',(iWidth/cols)))));
end;
end;
end;///if
end;//j
end;///fori
{
for i:=1 to 6 do
begin
showmessage(inttostr(R_CPData[1,i]));
end;//
}
///////取得数据库数据结束//////////////////////////
brush.Style:=Bsclear;
//pen.Color:=rgb(0,0,0);
//for i:=1 to cols do
//begin
for j:=1 to rows do
begin
textOut(PointX[1]+2,PointY[j]+2,Row_number1[j]);
end;
for j:=1 to rows do
begin
textOut(PointX[2]+2,PointY[j]+2,Row_number2[j]);
end;
for j:=1 to rows do
begin
textOut(PointX[3]+2,PointY[j]+2,Row_number3[j]);
end;
for j:=1 to rows do
begin
textOut(PointX[4]+2,PointY[j]+2,Row_number4[j]);
end;
for j:=1 to rows do
begin
textOut(PointX[5]+2,PointY[j]+2,Row_number5[j]);
end;
for j:=1 to rows do
begin
textOut(PointX[6]+2,PointY[j]+2,Row_number6[j]);
end;
for j:=1 to rows do
begin
textOut(PointX[7]+2,PointY[j]+2,Row_number7[j]);
end;
//end;
//////画圆///////////
//Ellipse(PointX[4],PointY[4],PointX[4]+strToInt(formatFloat('##0',(iHeight/Rows))),PointY[4]+strToInt(formatFloat('##0',(iWidth/cols))));
end;///withcanvas
end;//with
end;//ifctrl
end;
/////////////
procedure DrawTableX(ctrl:TControl;iTop,iLeft,Rows,Cols,iWidth,iHeight:integer;s_ID:string);
var
i:integer;
j:integer;
x:integer;
iPerUnit:integer;
iPerUnit1:integer;
CurrentPath:string;
R_CPData:Array[1..100,1..100] of integer;
FieldIndex:string;
begin
if (ctrl is TPaintBox) then
begin
with TPaintBox(ctrl) do
begin
with Canvas do
begin
brush.Style:=BSSolid;
Brush.Color:=rgb(255,255,255);
Pen.Color:=rgb(0,0,255);
//FillRect(rect(iTop,iLeft,iWidth+iLeft,iHeight+iTop));
for i:=0 to Cols do
begin
iPerUnit:=strToInt(formatFloat('##0',iLeft+(i)*(iWidth/cols)));
moveTo(iPerUnit,iTop);
LineTo(iPerUnit,iHeight+iTop);
PointX[i+1]:=strToInt(formatFloat('##0',iLeft+(i)*(iWidth/cols)));
end;//for i
for i:=0 to Rows do
begin
iPerUnit1:=strToInt(formatFloat('##0',iTop+(i)*(iHeight/Rows)));
moveTo(iLeft,iPerUnit1);
LineTo(iwidth+iLeft,iPerUnit1);
PointY[i+1]:=strToInt(formatFloat('##0',iTop+(i)*(iHeight/Rows)));
end;//forirows
////存储表格的坐标//////////
brush.Color:=rgb(255,0,0);
pen.Color:=rgb(255,0,0);
//////取得数据库数据////////////
CurrentPath:=ExtractFilePath(paramstr(0));
//Ellipse(rect(PointX[1],PointY[1],PointX[1]+strToInt(formatFloat('##0',(iHeight/Rows))),PointY[1]+strToInt(formatFloat('##0',(iWidth/cols)))));
//brush.Color:=rgb(255,255,255);
for i:=1 to 6 do
begin
with DataM.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=:sID');
parameters.ParamByName('sID').Value:=s_ID;
prepared;
open;
if RecordCount<>0 then
begin
FieldIndex:='R'+InttoStr(i);
R_CPData[1,i]:=FieldByName(FieldIndex).AsInteger;
end;//if
end;//with
end;///
for i:=1 to Rows do
begin
for j:=1 to 33 do
begin
if R_CPData[1,i]=j then
begin
case R_CPData[1,i] of
1..6:
Ellipse(rect(PointX[j],PointY[1],PointX[j]+strToInt(formatFloat('##0',(iHeight/Rows))),PointY[1]+strToInt(formatFloat('##0',(iWidth/cols)))));
7..12:
begin
x:=j-6;
Ellipse(rect(PointX[x],PointY[2],PointX[x]+strToInt(formatFloat('##0',(iHeight/Rows))),PointY[2]+strToInt(formatFloat('##0',(iWidth/cols)))));
end;
13..18:
begin
x:=j-12;
Ellipse(rect(PointX[x],PointY[3],PointX[x]+strToInt(formatFloat('##0',(iHeight/Rows))),PointY[3]+strToInt(formatFloat('##0',(iWidth/cols)))));
end;
19..24:
begin
x:=j-18;
Ellipse(rect(PointX[x],PointY[4],PointX[x]+strToInt(formatFloat('##0',(iHeight/Rows))),PointY[4]+strToInt(formatFloat('##0',(iWidth/cols)))));
end;
25..30:
begin
x:=j-24;
Ellipse(rect(PointX[x],PointY[5],PointX[x]+strToInt(formatFloat('##0',(iHeight/Rows))),PointY[5]+strToInt(formatFloat('##0',(iWidth/cols)))));
end;
31..36:
begin
x:=j-30;
Ellipse(rect(PointX[x],PointY[6],PointX[x]+strToInt(formatFloat('##0',(iHeight/Rows))),PointY[6]+strToInt(formatFloat('##0',(iWidth/cols)))));
end;
end;
end;///if
end;//j
end;///fori
{
for i:=1 to 6 do
begin
showmessage(inttostr(R_CPData[1,i]));
end;//
}
///////取得数据库数据结束//////////////////////////
brush.Style:=Bsclear;
//pen.Color:=rgb(0,0,0);
for i:=1 to cols do
begin
for j:=1 to rows do
begin
textOut(PointX[j]+2,PointY[i]+2,inttostr(6*(i-1)+j));
end;
end;
//////画圆///////////
//Ellipse(PointX[4],PointY[4],PointX[4]+strToInt(formatFloat('##0',(iHeight/Rows))),PointY[4]+strToInt(formatFloat('##0',(iWidth/cols))));
end;///withcanvas
end;//with
end;//ifctrl
//////////////////////////////
////////////////////////////
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -