仪器社区

[高分悬赏]delphi richedit载入网络上的文本并且不可编辑

i请叫我大帅比i 2010-11-17
新建个form放上richedit,从网络上读取文本并且在处于不可编辑状态,比如载入http:\\192.168.1.1\text.txt显示在richedit的文本框内,并且别人用dele删除不了,[代码处理的好再给加分... 新建个form 放上richedit ,从网络上读取文本并且在处于不可编辑状态,比如载入http:\\192.168.1.1\text.txt 显示在 richedit的文本框内,并且别人用dele删除不了, [代码处理的好 再给加分拜谢]
评论
全部评论
fang4163
uses IdHTTP;

var
idp :TIdHTTP;
ms :TMemoryStream;
begin
idp := TIdHTTP.Create(Form1);
ms := TMemoryStream.Create;
try
//把地址改为你的地址
idp.Get('http://ver.bo.sohu.com/version/serverlist.txt',ms);
ms.Position := 0;
RichEdit1.Lines.LoadFromStream(ms);
RichEdit1.ScrollBars := ssVertical;
RichEdit1.ReadOnly := True;
finally
FreeAndNil(ms);
FreeAndNil(idp);
end;
end;
7 0 2010-11-18 0条评论 回复
深圳华祥雨伞厂
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, IdBaseComponent, IdComponent,
IdTCPConnection, IdTCPClient, IdHTTP;

type
TForm1 = class(TForm)
RichEdit1: TRichEdit;
Button1: TButton;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
S:WideString;
H:TIdHTTP;
begin
H:=TIdHTTP.Create(nil);
try

S:=H.Get(Edit1.Text) ;//下载文本
RichEdit1.Text:=s;
RichEdit1.ReadOnly:=True;//这样不能删除
finally
H.Free;
H:=nil;
end;

end;

end.
13 0 2010-11-18 0条评论 回复
您可能感兴趣的社区主题
加载中...
发布 评论