请助无窗体dll怎么办图片Timage
请助无窗体dll怎么处理图片Timage
请助无窗体dll怎么处理图片
我查了Timgage需要 建立在Tform上
但是 我的dll需要 把数据保存为图片
可是我又没有窗体不能够用 image1.savetojpeg('C:\文件.jpg');
请问怎么处理。谢谢、
一调用就出错
------解决思路----------------------
img1都没有create;
procedure Test; stdcall
var i: integer;
begin
img1: =TImage.create(nil);
img1.Width := 200;
img1.Height := 200;
img1.Picture.Graphic := nil; // 消除原有的图形 或者 image.picture:=nil;都可以
img1.Canvas.Pen.Style := TPenStyle(0); // 设置画笔类型
img1.Canvas.MoveTo(0, 0); // 将当前画笔位置移到(0,0)
img1.Canvas.Font.Color := clBlack;
img1.Canvas.Font.Name := '宋体';
// img1.Canvas.Font.Style := [fsBold, fsItalic, fsUnderline, fsStrikeOut];
img1.Canvas.Font.Size := 11;
for i := 0 to 5 do
img1.Canvas.TextOut(0, i * 18, inttostr(i));
img1.savetofile('C:\己阅.jpg');
img1.free;
end;
请助无窗体dll怎么处理图片
我查了Timgage需要 建立在Tform上
但是 我的dll需要 把数据保存为图片
可是我又没有窗体不能够用 image1.savetojpeg('C:\文件.jpg');
请问怎么处理。谢谢、
一调用就出错
unit TestFun;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, dateutils, ExtCtrls;
var
img1: TImage;
procedure Test; stdcall
implementation
procedure Test; stdcall
var i: integer;
begin
img1.Width := 200;
img1.Height := 200;
img1.Picture.Graphic := nil; // 消除原有的图形 或者 image.picture:=nil;都可以
img1.Canvas.Pen.Style := TPenStyle(0); // 设置画笔类型
img1.Canvas.MoveTo(0, 0); // 将当前画笔位置移到(0,0)
img1.Canvas.Font.Color := clBlack;
img1.Canvas.Font.Name := '宋体';
// img1.Canvas.Font.Style := [fsBold, fsItalic, fsUnderline, fsStrikeOut];
img1.Canvas.Font.Size := 11;
for i := 0 to 5 do
img1.Canvas.TextOut(0, i * 18, inttostr(i));
img1.savetofile('C:\己阅.jpg');
end;
end.
------解决思路----------------------
img1都没有create;
procedure Test; stdcall
var i: integer;
begin
img1: =TImage.create(nil);
img1.Width := 200;
img1.Height := 200;
img1.Picture.Graphic := nil; // 消除原有的图形 或者 image.picture:=nil;都可以
img1.Canvas.Pen.Style := TPenStyle(0); // 设置画笔类型
img1.Canvas.MoveTo(0, 0); // 将当前画笔位置移到(0,0)
img1.Canvas.Font.Color := clBlack;
img1.Canvas.Font.Name := '宋体';
// img1.Canvas.Font.Style := [fsBold, fsItalic, fsUnderline, fsStrikeOut];
img1.Canvas.Font.Size := 11;
for i := 0 to 5 do
img1.Canvas.TextOut(0, i * 18, inttostr(i));
img1.savetofile('C:\己阅.jpg');
img1.free;
end;