- 积分
- 275
- 明经币
- 个
- 注册时间
- 2002-1-17
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2002-9-14 10:32:00
|
显示全部楼层
Delphi创建图层设置颜色的程序
创建图层设置颜色的程序(delphi4.0,acad14.01)
unit uint1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls,comobj;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
acad,ac,act,mdp,lay:OleVariant;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
acad:= GetActiveOleObject('AutoCAD.Application');
// acad:= CreateOleObject('AutoCAD.Application');
acad.Visible := True;
ac:=acad.activedocument;
mdp :=ac.modelspace;
lay:=ac.layers.add('asf');//创建名为ASF的图层
lay.Color := 1 ; //设图层的颜色为红色
end;
end. |
|