Delphi利用AutoCAD类型库调用DWF Viewer 的例子(原创)

来源:互联网 发布:win10不允许安装软件 编辑:程序博客网 时间:2024/05/20 03:05

 unit Unit1;
{ Delphi利用AutoCAD类型库调用DWF Viewer 的例子                                   }
{ 作者:钏裕民 2006年6月10日于昆明                                               }
{ Email :  chuanyumin@126.com.cn                                                 }
{ qq : 670856630                                                                 }
{ 说明:                                                                         }
{       实际上AutoCAD中有许多类型库,不仅是扩展名是.tlb的是类型库                }
{       许多AutoCAD安装目录下的.dll文件也是类型库,也可导入,可在编程中利用      }
{       这里,仅演示C:/Program Files/Autodesk/Autodesk DWF Viewer/AdView.dll     }
{       导入类型库后的利用,其它仍在摸索。                                       }

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, OleCtrls, StdCtrls, ExpressViewerDll_TLB;

type
  TForm1 = class(TForm)
    CExpressViewerControl1: TCExpressViewerControl;
    Button1: TButton;
    Label1: TLabel;
    Label2: TLabel;
    Button2: TButton;
    procedure MouseDBClick(ASender: TObject; nX, nY: Integer;
      const pHandled: IDispatch);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.MouseDBClick(ASender: TObject; nX, nY: Integer;
  const pHandled: IDispatch);
begin
  CExpressViewerControl1.BrowseProperties;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Close;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  CExpressViewerControl1.ExecuteCommand('NEXT');
end;

end.