Rendering DirectX to a picture box control

dellanooch

Newcomer
Joined
Dec 31, 2002
Messages
10
Location
Fairfax, VA
Maybe not necessarily a picture box control, but some sort of way of rendering to a confined area (not just the entire face of the form). Anyone have a way of doing this? A link to a tutorial or some sort of reference would be WONDERFUL.

- Andrew
 
Which version of DirectX? I only tried DX9 briefly but I seem to remember it accepting a parameter of type Control as a place to render to, so instead of passing a form you could try passing a Panel or PictureBox instead.
 
DX9 (the only officially supported version of DirectX that works with .NET) has a project template that will create a Direct3D project that writes to a picturebox control. When you select new project, select the DirectX project type. A wizard will come up asking for some parameters. I think it's the "Project Settings" page of the wizard that allows you to select a PictureBox.

-Ner
 
Ah yes, Nerseus. Thanks for pointing that out. But if you remember from other thread about the missing files I can't completely generate an error-free directx project. But regardless I think I'll be able to figure it out.

Thanks guys.
 
When you setup your PresentParameters, just set the DeviceWindow to the PictureBox control. Also, for obvious reasons, choose Windowed mode :)

-Nerseus
 
Visual Basic:
Device = New Device(0, DeviceType.Hardware, PictureBox.Handle, CreateFlags.HardwareVertexProcessing, PresentParams)
Works for me. If that's what your asking.
 
Back
Top