A set of .NET Framework managed libraries for developing graphical user interfaces.
AI answers are wrong.
Just call IDXGIFactory2.CreateSwapChainForHwnd
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I want to ask that how to load 3d in winform.
can I only load one 3d in one control? So I can click it.
A set of .NET Framework managed libraries for developing graphical user interfaces.
Answer accepted by question author
AI answers are wrong.
Just call IDXGIFactory2.CreateSwapChainForHwnd
Hi @mc ,
Thanks for reaching out.
Windows Forms does not support 3D rendering out of the box. To display 3D content, you need to host a rendering engine inside a control, using technologies like OpenGL, DirectX, or a library such as Helix Toolkit.
can I only load one 3D in one control?
A control typically renders one 3D scene, but that scene can contain multiple 3D objects. You’re not limited to just one model.
So I can click it.
Yes, but interaction (like object selection) needs to be implemented using the 3D library you choose (for example, picking via ray casting).
If your main goal is working with 3D, you may also consider WPF, which has better support for this scenario.
I hope this information is useful! If my answer was helpful to you, I would greatly appreciate it if you could follow the instructions here so others with the same problem can benefit as well.
To load and interact with 3D content in a Windows Forms app, use a technology that supports 3D (such as WPF 3D) and host it inside Windows Forms.
A common approach is:
UserControl that contains a Viewport3D and 3D content (for example, a cone or other mesh) using WPF 3D types like Model3D, GeometryModel3D, and Viewport3D.Model3D as the base for 3D objects, and GeometryModel3D with a mesh (triangles) to build the model.WpfUserControlHost).WindowsFormsIntegration.dllPresentationCorePresentationFrameworkWindowsBaseForm1), use an ElementHost control to host the WPF UserControl.Form.Load event, create an instance of the WPF UserControl and add it to the ElementHost’s Child (or children) collection. The ElementHost is then added to the form’s controls.UserControl code (for example, mouse events on the Viewport3D). Windows Forms just hosts the control.Viewport3D (inside one UserControl hosted in one ElementHost) can contain multiple 3D models (Model3D objects) in a scene. It is not limited to one 3D object.ElementHost+UserControl instances, each with its own 3D scene, if logical separation is preferred.So, 3D is not rendered directly by Windows Forms; instead, WPF 3D is used and hosted via ElementHost. One control can display one or many 3D models, and click handling is done in the WPF layer.
References: