Jump to content
  • Advertisement
Sign in to follow this  
melanieab

DirectX and tabpages

This topic is 4585 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I'm sorry, I know this is a game dev forum, but I can't find info (C#) anywhere else and I'm hoping someone here could help me out. I have a normal windows form with a bunch of tabpages on it. But in the beginning, I want to do a little DirectX intro (which I've already created) in a class that I've been running separately. Now I'm not sure how to put them together without having to close the intro form and then open the main form. Can anyone direct me to examples showing how to create a surface or something on the main form that will run the directx stuff? Thanks for any guidance!!! Melanie

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
hi, not sure on this, but can you get the hdc of the form? As "windows are windows", kind of thing theoretically you should be able to target d3d at any thing you want - even a button etc? I don't know how it is in winforms, but if you can get the handle to the form, or hdc, surface or something it may be possible.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
When you make the d3d device pass it the handle/idenifier of the form.

Share this post


Link to post
Share on other sites
Hi again,
I'm now trying to figure this part out:

"When you make the d3d device pass it the handle/identifier of the form."

I can't find anything online to guide me through this process, so this is what I'm trying:
In the main form I say
Intro intro = new Intro();
and then under (Intro) InitializeGraphics() I use something like
PresentParameters pp = new PresentParameters();
pp.DeviceWindowHandle = ...somehow say it's the form...
and then create the device.
device = new Device(0, DeviceType.Hardware, this, createFlags.SoftwareVertexProcessing, pp);

I guess it just comes down to not knowing how to tell the device that the form is the handle.
Again, thanks so much for any help!
Mel

Share this post


Link to post
Share on other sites
Hi, (I was the anomynous poster), I think its you r "this" parameter you need to change, can you get a handle to the tabed thingy on your form (the actual item where you want the d3d to go).

If you had to do something else with it what would you use to communicate with it? For instance in normal win32 you would get a handle to something first (such as a dialog box), then you could send it a message, with "sendmessage(..). I'm guessing your "this" parameter might be your main window or something? Try to pass the tabbed bit instead.

Hope that helps


PS I don't really know winforms etc I'm just going by how it would be in normal windows.

Share this post


Link to post
Share on other sites
On the tab you can place a panel which is probably the best control to render to. You should also explicitly pass the handle of the control to the device constructor.
i.e.
device = new Device(... panel.Handle ...);

I have come across some problems when that is not done.

I hope this helps.
Take care.

Share this post


Link to post
Share on other sites
If you want to see a code sample for the sound advices above, you might want to check out the sources for this tool, the VolumeViewer class in particular. It's a user control with a device attached to it that's used on a TabPage in the project, so it might be worth taking a look at.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!