My question is - Is it possible to wrap a GDI based MFC View class for use in C# .Net managed code.
Background :
I am currently working on a legacy app that was developed in MFC. It does same GDI based drawing through MFC's document view framework. It's all simple stuff, like drawing lines and bliting bitmaps. However, since it is an MFC app, the code for drawing is C++ MFC, implemented by extending the CView class, and adding drawing code to OnDraw() member function of the extended View class.
Now, I want to put on a nice UI on top of the application, so I was planning to use a thin C++/CLI wrapper, by keeping all the guts of my application in MFC, but simply using WPF for GUI - how controls are presented to the user. In order to save coding time and also to avoid marshalling, I would like to retain my extended MFC View class, and its GDI based drawing code. Is this possible? Or do I have rewrite the drawing code if I want to use WPF for GUI?
CViewderived classes to ATL and then implementend in aHWndHostusing C++/CLI. It was easy and works well, although you will have airspace issues (i.e. you cannot overlay WPF content on the native view). - Roger Rowland