COM Management in VB6: Take the Container Out of Control

I have a C # control that I use inside VB6, which is a rounded panel. I would like to know if there is a way to do this container management, sort of like Frame is a container. Basically, I want to be able to place things inside it so that they all move together, and, most importantly, place things in front of me.

Right now, if I put, say, a shortcut or command on top of it, it goes for my COM control and does nothing with Bring to Front and Send to Back .

Do I need to declare it as a container in vb6? Should the code come from C #?

Edit:

I signed the NDA, so I can’t post all the code here, but I will post some and explain some.

 public class AzPanel : Panel { protected const int BORDER_WIDTH = 3; protected int BORDER_RADIUS = 4; private object _lock = new object(); private bool regionNeedsRefresh = false; public AzPanel() : base() { this.SetStyle( ControlStyles.DoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.SupportsTransparentBackColor, true); this.SetStyle(ControlStyles.Selectable, false); base.BackColor = Color.Transparent; this.BorderColor = Color.DarkRed; this.ContentColor = Color.DarkGoldenrod; this.DoubleBuffered = true; base.Padding = new Padding(3, 3, 4, 4); } } 

There is something else to define a rounded area, but it is basically just a panel. I have a class that extends AzPanel, AzPanelCOM with the following attributes:

 [Guid("...")] [ProgId...] [ComVisible(true)] [ComdefaultInterface...] [ClassInterface(ClassInterfaceType.AutoDispatch)] 

Like the IAzPanelCOM interface, set it to VB6.

 [Guid("...")] [ComVisible(true)] public interface IAzPanelCOM { void DesignTimeReload(); //some other things } 

In the assembly, I use "regasm.exe" to create a type library (tlb) that I import into VB6 on a virtual machine with Windows xp and vs2010 (.net framework 4.0).

Then I can create instances of AzPanels, resize them and move them even during development, and I can add commands (buttons) to them without problems. However, when it comes to forms or shortcuts, they seem to appear behind the panel, and I cannot bring them to the fore.

+7
source share
1 answer

according to comment by @MarkBertenshaw

You cannot use windowless controls (form, label, et.c) with the .NET component. However, you can use a VB control, for example. The frame (no frame) or Picture Box inside the .NET component into which you place these elements without windows.

+1
source

All Articles