I’m building a Windows Form application that controls 3D volume rendering using an ArrayFire array object. The array is unmanaged. In the form constructor, I load and render the volume.
I have a Trackbar that controls the opacity of the volume and a corresponding scroll event handler. However, I can’t figure out how to pass the volume array to the Trackbar scroll event handler so I can re-render the volume.
I can’t make the volume array an attribute of the Form because, apparently, managed classes cannot have unmanaged attributes.
What’s the best way to do this?
A managed class cannot have a field that is an unmanaged type, but it can have a field that is a pointer to an unmanaged type. Stick a
*at the end of your unmanaged type, and you should be able to pass it to whatever methods you want, and store it wherever you want.