Maestro1024
Maestro1024

Reputation: 3293

how to get C++ GDI code into a C# project

I have 2 projects a C# project that has most everything that I need and a GDI C++ project that has a control and some logic I want to put into the C# project.

Do I wrap the GDI C++ project somehow as a control? Is there some newer technology that I should update the GDI code to use (not sure how GDI is different than GDI+).

Just getting started looking at this and have no idea how to integrate the two.

Upvotes: 0

Views: 198

Answers (1)

Jason Williams
Jason Williams

Reputation: 57892

it depends on the complexity of your c++ code.

if it's large or complex then it'd be best to wrap it and use it from the c# (e.g. wrap it in a COM wrapper, or even run it as a separate process that simply displays its window in your host.

If it's not too complex then it is likely to be easier and cleaner to port it to c#. A lot of c++ code for logic is easy to port to c#, and there is very little difference between GDI and GDI+, so I would expect porting to be fairly straight forward.

The deciding factor might just be your own confidence in using com or getting GDI+ to render the same thing.

Upvotes: 1

Related Questions