Thats interesting,
i've been triying to make a custom control class that renders itself using directX this would save me from having to write the plumbing code of the controls?
Also Is it possible to create and MDI application where one of the MDI child forms renders itself using directX (but not the Parent)?
Main Topics
Browse All Topics





by: DivinityPosted on 2005-06-21 at 06:37:10ID: 14265723
If you look at this line in your InitializeGraphics() method: Processing , presentParams); Processing , presentParams);
_device = new Device(0, DeviceType.Hardware, this, CreateFlags.SoftwareVertex
you can see that one of the parameters you supply is "this". Because "this" denotes the current object itself, you are supplying a reference to the form here. But you can just as easily supply another control. A good example would be a PictureBox. Just add a PictureBox to your form and (assuming you didn't rename it) change the line above to:
_device = new Device(0, DeviceType.Hardware, pictureBox1, CreateFlags.SoftwareVertex
DirectX will now use the picturebox as its rendertarget, and not the complete form. I've never tried to do this with other controls than the picturebox, but in theory, you could supply a textbox or a label and it should work too (though i don't know, what kind of results you will be getting)