DELPHI语句顺序排列问题!(100分)

  • 主题发起人 主题发起人 6713829
  • 开始时间 开始时间
6

6713829

Unregistered / Unconfirmed
GUEST, unregistred user!
这些是全部源文件<br>unit Unit1;<br><br>interface<br><br>uses<br> &nbsp;Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br> &nbsp;Dialogs, StdCtrls;<br><br>type<br> &nbsp;TForm1 = class(TForm)<br> &nbsp; &nbsp;Edit1: TEdit;<br> &nbsp; &nbsp;Edit2: TEdit;<br> &nbsp; &nbsp;Button1: TButton;<br> &nbsp; &nbsp;Label1: TLabel;<br> &nbsp; &nbsp;Label2: TLabel;<br> &nbsp; &nbsp;Label3: TLabel;<br> &nbsp; &nbsp;Label4: TLabel;<br> &nbsp; &nbsp;Label5: TLabel;<br> &nbsp; &nbsp;Label6: TLabel;<br> &nbsp; &nbsp;Label7: TLabel;<br> &nbsp; &nbsp;Label8: TLabel;<br> &nbsp; &nbsp;Label9: TLabel;<br> &nbsp; &nbsp;Label10: TLabel;<br> &nbsp; &nbsp;Label11: TLabel;<br> &nbsp; &nbsp;Label12: TLabel;<br> &nbsp; &nbsp;procedure Button1Click(Sender: TObject);<br> &nbsp;private<br> &nbsp; &nbsp;{ Private declarations }<br> &nbsp;public<br> &nbsp; &nbsp;{ Public declarations }<br> &nbsp;end;<br><br>var<br> &nbsp;Form1: TForm1;<br> &nbsp;stream1,stream2:TMemoryStream;<br> &nbsp;buffer:array of char;<br> &nbsp;Size:Int64;<br> &nbsp;Pos,Leng,ok:Integer;<br><br>implementation<br><br>{$R *.dfm}<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>begin<br>stream1:=TMemoryStream.Create;<br>stream2:=TMemoryStream.Create;<br>stream1.LoadFromFile(Edit1.Text);<br>Size:=stream1.Size;//总字节数<br>Leng:=200;//每块占用字节<br>Pos:=0;//当前已发字节<br>ok:=Size;//剩余字节<br>Label7.Caption:=Inttostr(size);<br>//计算发送次数<br>If (Size Mod Leng)&lt;&gt;0 Then<br>Begin<br>Label11.Caption:=Inttostr(Size Div Leng+1);<br>End<br>Else<br>Begin<br>Label11.Caption:=Inttostr(Size Div Leng);<br>End;<br>Begin<br>//aaa<br>Label8.Caption:=Inttostr(Leng);<br>Label9.Caption:=Inttostr(Pos);<br>Label10.Caption:=Inttostr(Ok);<br>//bbb<br>setlength(buffer,1024);<br>stream1.readBuffer(buffer,1024);<br>stream2.WriteBuffer(buffer,1024);<br>End;<br>stream2.SaveToFile(Edit2.Text);<br>stream1.Free;<br>stream2.Free;<br>Form1.Caption:='完成';<br>end;<br><br>end.<br><br><br><br>问题出在这里,我碰到的问题在这里!!!!!<br>Begin<br>//aaa<br>Label8.Caption:=Inttostr(Leng);<br>Label9.Caption:=Inttostr(Pos);<br>Label10.Caption:=Inttostr(Ok);<br>//bbb<br>setlength(buffer,1024);<br>stream1.readBuffer(buffer,1024);<br>stream2.WriteBuffer(buffer,1024);<br>End;<br>这样label标签显示正常,但是按照这样的顺序<br>Begin<br>//bbb<br>setlength(buffer,1024);<br>stream1.readBuffer(buffer,1024);<br>stream2.WriteBuffer(buffer,1024);<br>//aaa<br>Label8.Caption:=Inttostr(Leng);<br>Label9.Caption:=Inttostr(Pos);<br>Label10.Caption:=Inttostr(Ok);<br>End;<br>label标签的是很多位庞大的数字,请问大侠们这到底是什么问题啊?<br>怎么解决啊?<br>重复一次,<br><br>注明有aaa和bbb,如果aaa在bbb上面label标签显示数据为正常,<br>注明有aaa和bbb,如果bbb在aaa上面label标签显示数据为乱码.
 
都不知道你在说什么?可能是我的理解能力太弱了
 
帮你顶一下,我得做饭去了.
 
变量在线程内执行就没有错误了!
 
ok,已解决!
 
后退
顶部