6
6713829
Unregistered / Unconfirmed
GUEST, unregistred user!
这些是全部源文件<br>unit Unit1;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br> Dialogs, StdCtrls;<br><br>type<br> TForm1 = class(TForm)<br> Edit1: TEdit;<br> Edit2: TEdit;<br> Button1: TButton;<br> Label1: TLabel;<br> Label2: TLabel;<br> Label3: TLabel;<br> Label4: TLabel;<br> Label5: TLabel;<br> Label6: TLabel;<br> Label7: TLabel;<br> Label8: TLabel;<br> Label9: TLabel;<br> Label10: TLabel;<br> Label11: TLabel;<br> Label12: TLabel;<br> procedure Button1Click(Sender: TObject);<br> private<br> { Private declarations }<br> public<br> { Public declarations }<br> end;<br><br>var<br> Form1: TForm1;<br> stream1,stream2:TMemoryStream;<br> buffer:array of char;<br> Size:Int64;<br> 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)<>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标签显示数据为乱码.