Can/how do you host a full VB6 Form in a C# WPF app?

前端 未结 5 1325
春和景丽
春和景丽 2020-12-31 20:39

I am currently exploring the option of porting some older VB6 application to WPF with C#. The plan, in phase one, is to port several key forms and not all the application. T

5条回答
  •  离开以前
    2020-12-31 20:53

    I found a method to do what was needed within WinForms rather than WPF at this point. http://www.codeproject.com/KB/vb-interop/VB6formsinNET.aspx I figure if I can get it working 100% there I can port it over to WPF or worse case host the WinForm element in the WPF form if I absolutely have too (U-G-L-Y).

    Anyway, I've gotten a bit closer, but am having a very odd issue with certain controls painting too the screen. Radio/Option buttons are rendering as solid black:

    http://www.evocommand.com/junk_delete_me/optionbuttons.png

    I've tried explicitly changing the controls' background color from buttonface to a fixed color and it still does it. I'm assuming it's a layering issue with the option buttons being within the frame control. I'm at a bit of a loss on how to proceed without massive rework of the VB6 content to change the options buttons to checkboxes. It's a hefty app and there are 600+ option button controls across the application that I don't exactly want to deal with.

    EDIT: I was able to confirm it has something to do with the layering of the option within a Frame control. If pulled out to the base form the issue does not occur: http://www.evocommand.com/junk_delete_me/optionbuttons2.png

提交回复
热议问题