CAD把当前图形保为一个jpg文件(com接口Delphi语言)

时间:2022-11-24 16:32:04
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
procedure TForm2.Button1Click(Sender: TObject);
       var
             param            : IMxDrawResbuf;
             ret               : IMxDrawResbuf;
       begin
             // 创建参数对象
             param :=  CoMxDrawResbuf.Create();
              // 文件路径,-10是参数的DXF组码,取-10控件自动确定DXF组码
             param.AddString('c:test.jpg');
             // jpg的宽度
             param.AddLong(1200);
             // jpg的高度
             param.AddLong(500);
             // jpg的背景色,    16777215 = 0xFFFFFF,是白色
             param.AddLong(16777215);
             // 调用自定义函数 Mx_SaveJpgFileEx
             ret := IMxDrawResbuf(MxDrawX1.CallEx('Mx_SaveJpgFileEx',param));
             if ret.AtString(0) = 'Ok' then
             begin
               showmessage('保存成功到C:test.jpg');
             end;
       end;