Share this post

Link to post

Share on other sites

Do you have an existing renderer that you want to add into a WinForms application, or are you starting from scratch? Also, are you already familiar with WinForms development and DirectX development on their own? Your answers to these questions will help to inform how you should proceed!

Share this post

Link to post

Share on other sites

I would not recommend using WinForms for integration with DirectX. It is possible, but not optimal. You need to supply a WHND from your WinForms application down to the C++ code that you use when you setup your DirectX-devices for rendering. This means that DirectX will "own" the render surface on this HWND and you will not be able to overlay any .NET graphics components (like button or texts etc) on top of your DirectX-drawing. You need to provide all drawing down in the DirectX-code. This might be fine you if you don't want any overlay information handled by the .NET code.

What I instead would like to recommend is that you build your .NET-application in WPF instead. WPF has a component named D3DImage that is used for interoperating a DirectX-surface with the WPF rendering pipeline. This is much cleaner and provides no limitations on your GUI layout in the .NET application.