Displaying an image generated in c++/CLI DLL
-
Hi All, I have a routine that calls a C++/CLI DLL from C# in order to generate an image. After the generation, I have (in the DLL) a pointer to 'unsigned short' array and the image dimensions. Now I'd like to somehow use this pointer to display the image in a C# form (using PictureBox ot ony other suitable component), but I have no idea how... Thanks for the help, Eyal.
-
Hi All, I have a routine that calls a C++/CLI DLL from C# in order to generate an image. After the generation, I have (in the DLL) a pointer to 'unsigned short' array and the image dimensions. Now I'd like to somehow use this pointer to display the image in a C# form (using PictureBox ot ony other suitable component), but I have no idea how... Thanks for the help, Eyal.
Create a Bitmap of the right size with the appropriate pixel depth (not sure what that is for ushort, you might have to convert on the fly), call LockBits to get the address of its data, and copy the data from the C array into that one (using unsafe code or Marshal methods, depending on your requirements).
-
Hi All, I have a routine that calls a C++/CLI DLL from C# in order to generate an image. After the generation, I have (in the DLL) a pointer to 'unsigned short' array and the image dimensions. Now I'd like to somehow use this pointer to display the image in a C# form (using PictureBox ot ony other suitable component), but I have no idea how... Thanks for the help, Eyal.
you might be lucky and find the solution here[^]; make sure to read all of it though. :)
Luc Pattyn [My Articles] Nil Volentibus Arduum