L
Lei Jiang
I have a drawing application written in C++, and want to use it in a
framework written in C#. Since the amount of C++ code is very large, it's
unpractical to translate them to C#. So I want to use the window in C++ as a
control in C#. It seems there are a lot of method to do this :
1. Rebuild the C++ code in C++/CLI, and try to call it in managed world.
2. Pass the HWND of a C# form to the C++ code, and attach it to a C++ Window
and draw on it.
3. Pass the HWND of a C++ window to C# code, and attach it to a C# form and
draw on it.
4. Pass the HDC of the C# form to the C++ code, and draw on that DC.
5. ...
I think this is a common problem in porting old C++ code to C#, so there
must be someone has already solved this problem. Could anyone give me some
advice?
Thanks!
framework written in C#. Since the amount of C++ code is very large, it's
unpractical to translate them to C#. So I want to use the window in C++ as a
control in C#. It seems there are a lot of method to do this :
1. Rebuild the C++ code in C++/CLI, and try to call it in managed world.
2. Pass the HWND of a C# form to the C++ code, and attach it to a C++ Window
and draw on it.
3. Pass the HWND of a C++ window to C# code, and attach it to a C# form and
draw on it.
4. Pass the HDC of the C# form to the C++ code, and draw on that DC.
5. ...
I think this is a common problem in porting old C++ code to C#, so there
must be someone has already solved this problem. Could anyone give me some
advice?
Thanks!