当前位置:编程学习 > Delphi >>

这个DELPHI小程序哪里错了?请高们帮忙看看

unit Unit1; inte易做图ce uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Buttons, IdTCPServer, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, ExtCtrls; type TForm1 = class(TForm) Image1: TImage; Image2: TImage; IdTCPClient1: TIdTCPClient; IdTCPServer1: TIdTCPServer; BitBtn1: TBitBtn; procedure BitBtn1Click(Sender: TObject); procedure IdTCPServer1AfterCommandHandler(ASender: TIdTCPServer; AThread: TIdPeerThread); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.BitBtn1Click(Sender: TObject); var temp:TMemoryStream; begin Temp:=TMemoryStream.Create; //将图像文件保存到内存流 Image1.Picture.Graphic.SaveToStream(Temp); //发送图像信息 IdTCPCLIENT1.Connect(); IdTCPCLIENT1.WriteStream(Temp); IdTCPCLIENT1.Disconnect(); Temp.Free; end; procedure TForm1.IdTCPServer1AfterCommandHandler(ASender: TIdTCPServer; AThread: TIdPeerThread); const TempImagefile='d:\test.bmp'; //设置的临时图像文件 var t:TMemoryStream; begin t:=TMemoryStream.Create; AThread.Connection.ReadStream(t,-1,True); //从连接中取得流式数据 t.SaveToFile(TempImageFile); Image2.Picture.LoadFromFile(TempImageFile); t.Free; end; 就9分了啊 不好意思哈
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,