Z
zhuhaifeng20
Unregistered / Unconfirmed
GUEST, unregistred user!
if OpenDialog1.Execute then fhandle:=FileOpen(OpenDialog1.FileName,0); mystream:=TMemoryStream.Create; TMemoryStream(mystream).LoadFromFile(Opendialog1.FileName); ca:=10*pi/180; for j:=1023 downto 0 do begin for i:=0 to 127 do begin mystream.Read(mybyte,1); for k:=0 to 7 do begin case k of 0:begin cb:=zuobiao(i*8+k,1023-j,ca);//使用自建函数zuobiao() dx:=cb.X; dy:=1023-cb.Y; if (mybyte and 128) =128 then image1.Canvas.Pixels[dx,dy]:=clWhite else image1.Canvas.Pixels[dx,dy]:=clBlack; end; 1:begin cb:=zuobiao(i*8+k,1023-j,ca); dx:=cb.X; dy:=1023-cb.Y; if (MyByte and 64) =64 then image1.Canvas.Pixels[dx,dy]:=clWhite else image1.Canvas.Pixels[dx,dy]:=clBlack; end; 2:begin cb:=zuobiao(i*8+k,1023-j,ca); dx:=cb.X; dy:=1023-cb.Y; if (Mybyte and 32) =32 then image1.Canvas.Pixels[dx,dy]:=clWhite else image1.Canvas.Pixels[dx,dy]:=clBlack; end; 3:begin cb:=zuobiao(i*8+k,1023-j,ca); dx:=cb.X; dy:=1023-cb.Y; if (MyByte and 16) =16 then image1.Canvas.Pixels[dx,dy]:=clWhite else image1.Canvas.Pixels[dx,dy]:=clBlack; end; 4: begin cb:=zuobiao(i*8+k,1023-j,ca); dx:=cb.X; dy:=1023-cb.Y; if (MyByte and 8) =8 then image1.Canvas.Pixels[dx,dy]:=clWhite else image1.Canvas.Pixels[dx,dy]:=clBlack; end; 5: begin cb:=zuobiao(i*8+k,1023-j,ca); dx:=cb.X; dy:=1023-cb.Y; if (MyByte and 4) =4 then image1.Canvas.Pixels[dx,dy]:=clWhite else image1.Canvas.Pixels[dx,dy]:=clBlack; end; 6:begin cb:=zuobiao(i*8+k,1023-j,ca); dx:=cb.X; dy:=1023-cb.Y; if (MyByte and 2) =2 then image1.Canvas.Pixels[dx,dy]:=clWhite else image1.Canvas.Pixels[dx,dy]:=clBlack; end; 7: begin cb:=zuobiao(i*8+k,1023-j,ca); dx:=cb.X; dy:=1023-cb.Y; if (MyByte and 1) =1 then image1.Canvas.Pixels[dx,dy]:=clWhite else image1.Canvas.Pixels[dx,dy]:=clBlack; end; end; end; end; end;我使用了run中的add watch对dx,dy进行跟踪,运行到 dx:=cb.X;dy:=1023-cb.Y;时dx,dy显示值正常,但运行到image1.Canvas.Pixels[dx,dy]:=clwhite/clblack后dx值就变成variable,而dy值是正确的,没变