tags:

views:

170

answers:

1

I am integrating with an application that uses plugins. I have my own plugin that is provided an HDC to draw on, this works fine using C#

Graphics gfx = Graphics.FromHdc(hdc);

I can then draw using GDI without issue.

I would like to start experimenting with XNA, I've loaded a few sample projects and had a look through the code. It appears that by default XNA handles the creation of the window and when I should be redrawing each frame.

What I need to be able to do is use XNA to render a frame when the plugin's render event is raised. Then either render directly to the plugin HDC or to copy the XNA image to it.

Can this be done? Does anyone have any examples? I'm very new to XNA.

Thanks

+1  A: 

There is a winforms sample that shows you how to custom create the XNA graphics device and then render it onto a windows form control.
http://creators.xna.com/en-US/sample/winforms_series1

Joel Martinez
I've seen this before while looking to use XNA for another project. I hadn't even thought of it for this. I'm looking at it now before I accept this as the answer. Thanks
Nanook