Wpf – VB6 ActiveX Control Inside WPF With Scrollbars

activexvb6wpf

I have some legacy VB6, which I am hosting inside an ActiveX control, which is in my WPF application.

Despite putting the control inside of a DockPanel, which is inside a ScrollViewer, the VB6 displays outside the bounds of both, sitting on top of the rest of the application.

Does anyone know how I can keep the VB6 inside of the ScrollViewer without it spilling out onto the rest of the application?

ScrollViewer – expands to fill an area

Has a child element…

DockPanel – fixed to the height and width of the VB6 form

Has a child element…

VB6

Any help or guidance will be greatly appreciated.

Best Answer

I don't think you can do this, the ActiveX control is just going to sit on top of any XAML you wrap it in. As a workaround you could try creating a control in WinForms that contains your ActiveX control and handles the scrolling, then embed that in the WPF app. It's a bit hacky, and might be a pain if you need to resize, but it SHOULD work :-)

Related Topic