Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subclassing ActiveX control

Status
Not open for further replies.

jpropper

Programmer
Jun 20, 2002
2
US
Hello -

I'm trying to figure out how to subclass an ActiveX control. I need to
extend the functionality of it. Ultimately I need to intercept OnPaint and
OnMouseXXX events. Once I have processed them, I then need to pass them on
to the ActiveX control so that it can process them.

I'm trying to do something like:

public class MyClass : AxTheActiveXControl
{
public MyClass() {}
}

I was thinking that I would inherit the ActiveX controls properties.

So, in the code that instantiates MyClass

MyClass myClass = new MyClass();
myClass.property = 1;

I don't seem to be getting anywhere with this. Obviously I'm missing
something.

Any thoughts, pointers, etc would be appreciated.

Thanks,
john

 
I don't know if you can do this. In reality, you're not subclassing the Ax control, but the wrapper that .NET puts around it. And.. I don't know if you have access to that - it might be generated when you set a reference to your OCX, or it might be a piece of generic code that is shared amongst all Ax controls that you use.

Chip H.
 
Thanks Chip. I was beginning to wonder that myself. Turns out that I forgot to call the base class constructor.

The code should read:

public class MyClass : AxTheActiveXControl
{
public MyClass() : base() {}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top