有一TXT文件.格式已经排好了.
现在要按格式生成若干张BMP图片.每张图片只显示TXT文件的四行.
即1-4行生成001.bmp 5-8 生成002.bmp
解决方案 »
- 请问在DEPHI中判断XML的元素是否存在
- 客户端用TTCPClient发送Byte数组,服务端用Java写的Socket监听。为什么收到的数据不一致?
- datetimepicker显示日期怎么设置成当前系统的时间啊?????
- 强烈搜索中,如何让TPaintBox使用twip作为宽度和高度?
- ADOQUERY控件应怎样用
- 以下的这个小写数字转大写数字的函数如何修改?
- 如何让dbgrid中的显示长度等于每个字段选出的值的最大值?
- 请高手帮助!我写了个注册表!可是第一次运行好的!以后一直提示“failed to set data for max”!
- 能不能获取ftp站点下的某一目录下的文件列表?
- 在局域网内,如何通过ip地址得到计算机所在的组名
- 如何将我写的函数共享给其他单元文件?
- 关于delphi的if语句(有elseif吗)
procedure TForm1.Button1Click(Sender: TObject);
var
Bmp: TBitmap;
x, y: Integer;
i: Integer;
begin
Bmp := TBitmap.Create; Bmp.Width := 400;
Bmp.Height := 300; x := 10;
y := 10; for i := 0 to 10 do
begin
Bmp.Canvas.TextOut(x, y, 'Just a test');
y := y + Bmp.Canvas.TextHeight('Just a test');
end; Bmp.SaveToFile('c:\Test.bmp');end;
var
Bmp: TBitmap;
x, y: Integer;
i: Integer;
begin
Bmp := TBitmap.Create; Bmp.Width := 400;
Bmp.Height := 300; x := 10;
y := 10; for i := 0 to 10 do
begin
Bmp.Canvas.TextOut(x, y, 'Just a test');
y := y + Bmp.Canvas.TextHeight('Just a test');
end; Bmp.SaveToFile('c:\Test.bmp');
Bmp.Free;
end;
先謝謝樓上的.
但是不是我提出問題的回答.
是從文件裡面取數據(ReadLn()).而且是每四行一張圖片.
多多思考,自己的编程水平才会提高。
procedure TForm1.Button1Click(Sender: TObject);
var
Bmp: TBitmap;
i, ReadLines: Integer;
f: TextFile;
s: string;
x, y: Integer;
begin
Bmp := TBitmap.Create; Bmp.Width := 400;
Bmp.Height := 300; AssignFile(f, 'c:\Test.txt');
Reset(f); i := 0;
while not Eof(f) do
begin
ReadLines := 0;
x := 10;
y := 10;
Bmp.Canvas.FillRect(Rect(0, 0, 400, 300));
while not Eof(f) do
begin
Readln(f, s);
Bmp.Canvas.TextOut(x, y, s);
y := y + Bmp.Canvas.TextHeight(s);
Inc(ReadLines);
if ReadLInes = 4 then
break;
end;
Bmp.SaveToFile('c:\Test' + IntToStr(i) + '.bmp');
Inc(i);
end; Bmp.Free;
CloseFile(f);
end;