[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.interop

Using standard Windows Forms controls as ActiveX controls

larsgregersen

10/15/2007 10:47:00 AM

Hi

I have created a couple of Windows Forms controls in C# either by
composition or by subclassing existing controls. I'm able to use these
controls as ActiveX controls by using "register for COM Interop". I then
access the control in a old application written in C++ (using VS 205). This
works fine!

What if I wish to use a standard control, e.g. TreeView, as an ActiveX
control? I can of course subclass the control, without changing the
behaviour, but surely there must exist an easier way?!?!

Are the Windows Forms Controls already exposed as standard AxtiveX controls?
What DLLs whould I #import to access these?

Are there any tricks or examples on how to add event handlers?

4 Answers

(Mattias Sjögren)

10/15/2007 6:48:00 PM

0

>What if I wish to use a standard control, e.g. TreeView, as an ActiveX
>control?

Why would you want to do that? Can't you use the native TreeView
control, or the ActiveX version for VB6?


Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.n... | http://www.dotneti...
Please reply only to the newsgroup.

larsgregersen

10/18/2007 8:57:00 AM

0

"Mattias Sjögren" wrote:

> >What if I wish to use a standard control, e.g. TreeView, as an ActiveX
> >control?
>
> Why would you want to do that? Can't you use the native TreeView
> control, or the ActiveX version for VB6?

I have to use an ActiveX control. This control goes into the user interface
of a program developed by a third party and it only accepts ActiveX controls.

My reason for using the TreeView control as a basis for this work is that I
wish to have the exact same appearance as this control has. The third party
application uses trees and I wish to have the same look. I have failed to get
the same appearance even on my own computer and when moving this to a
computer running Vista and/or 64-bit then the appearance of the TreeView
control may change, but my ActiveX control may stay the same.

I haven't been able to find out if the Microsoft Treeview Control 6.0 is
linked to the TreeView control in .NET (SysTreeView32). If that is indeed the
case then using this ActiveX control will of course simplify my work.

(Mattias Sjögren)

10/20/2007 5:26:00 PM

0


>I haven't been able to find out if the Microsoft Treeview Control 6.0 is
>linked to the TreeView control in .NET (SysTreeView32). If that is indeed the
>case then using this ActiveX control will of course simplify my work.

It depends on what you actually mean by "linked by" but the short
answer is probably yes. They are based on the same code and provide
pretty much the same feature set.

If I recall correctly, the 6.0 release of the MS Common Controls
ActiveX library (Mscomctl.ocx) was built from the same code base as
Comctl32.dll (the OS library that provides the SysTreeView32 window
class and all the other common controls), but statically linked the
code (which means it doesn't depend on Comctl32.dll and doesn't
benefit from features added to later versions of it). The 5.0 release
(Comctl32.ocx) was more like a wrapper on top of Comctl32.dll.


Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.n... | http://www.dotneti...
Please reply only to the newsgroup.

larsgregersen

10/22/2007 6:06:00 AM

0

"Mattias Sjögren" wrote:
> >I haven't been able to find out if the Microsoft Treeview Control 6.0 is
> >linked to the TreeView control in .NET (SysTreeView32). If that is indeed the
> >case then using this ActiveX control will of course simplify my work.
>
> It depends on what you actually mean by "linked by" but the short
> answer is probably yes. They are based on the same code and provide
> pretty much the same feature set.
>
> If I recall correctly, the 6.0 release of the MS Common Controls
> ActiveX library (Mscomctl.ocx) was built from the same code base as
> Comctl32.dll (the OS library that provides the SysTreeView32 window
> class and all the other common controls), but statically linked the
> code (which means it doesn't depend on Comctl32.dll and doesn't
> benefit from features added to later versions of it). The 5.0 release
> (Comctl32.ocx) was more like a wrapper on top of Comctl32.dll.

Thank you. Information like this is very hard to find.

Lars