看看怎么不能实现,如果元素为0时,不能显示颜色clteal;(30分)

  • 主题发起人 主题发起人 dyxhy2003
  • 开始时间 开始时间
D

dyxhy2003

Unregistered / Unconfirmed
GUEST, unregistred user!
Const
ClassHeight=20;
ClassWidth =13;
var
ClassWorkSheet:Array [1..ClassHeight,1..ClassWidth] of byte;
LassWorkSheet:Array [1..ClassHeight,1..ClassWidth] of byte;

procedure TForm1.FormPaint(Sender: TObject);
var
i,j:integer;
x1,y1,x2,y2:integer;
newrect:Trect;
begin
for j:=1 to Classheight do
for i:=1 to Classwidth do
ClassWorkSheet[j,i]:=255;

for j:=1 to Classheight do
for i:=1 to Classwidth do
begin
if ClassWorkSheet[j,i]=LassWorkSheet[j,i] then continue
else
begin
x1:=(i-1)*20;
y1:=(j-1)*20;
x2:=i*20;
y2:=j*20;
newrect:=rect(x1,y1,x2,y2);
case ClassWorkSheet[j,i] of
0:canvas.Brush.Color:=clteal;
1:canvas.Brush.Color:=clsilver;
2:canvas.Brush.Color:=clred;
3:canvas.Brush.Color:=cllime;
4:canvas.Brush.Color:=clBlue;
5:canvas.Brush.Color:=clfuchsia;
6:canvas.Brush.Color:=claqua;
7:canvas.Brush.Color:=clyellow;
end;
if ClassWorkSheet[j,i]>0 then
begin
canvas.FillRect(newrect);
canvas.pen.Color:=clgray;
canvas.MoveTo(x1,y1);
canvas.LineTo(x1,y1+19);
canvas.LineTo(x1+19,y1+19);
canvas.pen.Color:=clwhite;
canvas.LineTo(x1+19,y1);
canvas.LineTo(x1,y1);
end
else
begin
canvas.FillRect(newrect);
end;
end;
end;
end;
 
是哪没写还是~~~~~~~?
 
你的LassWorkSheet[j,i]在哪里赋值的?(可能默认为0)
ClassWorkSheet[j,i]:=255是255,如果为0,可能 if ClassWorkSheet[j,i]=LassWorkSheet[j,i] then continue起作用了

 
接受答案了.
 

Similar threads

后退
顶部