ActiveX问题 ( 积分: 20 )

  • 主题发起人 主题发起人 jhlz1968
  • 开始时间 开始时间
J

jhlz1968

Unregistered / Unconfirmed
GUEST, unregistred user!
我写了一个控件,是从TCustomControl继承的。在它的Create事件中我定义了它的大小:
Width:=30;
Height:=30;
我把它转换成ActiveX控件,注册成功后,我在VFP中使用此控件,它的宽和高都变为100,不是30了,但我在Delphi中使用则一切正常。
请问怎样才能使它的宽和高都为30。

 
我写了一个控件,是从TCustomControl继承的。在它的Create事件中我定义了它的大小:
Width:=30;
Height:=30;
我把它转换成ActiveX控件,注册成功后,我在VFP中使用此控件,它的宽和高都变为100,不是30了,但我在Delphi中使用则一切正常。
请问怎样才能使它的宽和高都为30。

 
不是在create事件中写
而是重载create 方法
 
TO:张鸿林

我就是重载了Create方法。
各位大富翁高手,如何解决呢?
 
你上面说的是Create事件
pubic
constructor Create(Aowner:Tcomponent;S:String);override;
应该可以

(修改:我这个跟贴可能是跟错地方了?)
 
TO:张鸿林
我的组件中:
......
public
constructor Create(AOwner:TComponent);override;
destructor Destroy
override;
......

{ TNl }

constructor TNl.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
width:=30;
Height:=30;
FPic:=TImage.Create(Self);
with FPic do
begin
Parent:=Self;
Height:=Self.Height;
Width:=Self.Width;
Transparent:=True;
Picture.Bitmap.LoadFromResourceName(hInstance,'mybmp');
end;
end;

destructor TNl.Destroy;
begin
FPic.Free;
inherited Destroy;
end;

有什么错误吗?
 
没有人知道吗?
 
看代码确实没问题
搞不好,vfp调用任何ActivX都这样?做个试验看看
或者,你把这个控件在vb里调用看看
 
接受答案了.
 
后退
顶部