Post

 Resources 

Console

Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 VBGamer
 VBGamer
 D3D in PictureBox control
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

STufaro
Neophyte

8 Posts

Posted - Jun 18 2007 :  10:19:32 AM  Show Profile  Send STufaro an AOL message  Reply with Quote
Hey guys, you may remember me as the landscape renderer idiot. Now I've got another seemingly simple question.

Instead of setting a userform as my window in which to render, I'd like to use a PictureBox. I try to create a device by passing the CreateDevice method the hWnd of my PictureBox, but I get an automation error. How descriptive those automation errors are.

I tried setting all my PictureBox properties to the same as the form's (note that the code DOES work when the PictureBox isn't the target), excluding LinkTopic (because I can't and shouldn't have to set that anyway). No dice.

Is there some flag I have to specify to get D3D to create a device inside a PictureBox?

Any advice is appreciated!

I'm using DirectX 8 and VB6. I'll have code as soon as I get to my other computer, but for now anyone who wants to help can simulate the problem by setting the DeviceWindow to the hWnd of a PictureBox.

Much obliged,

Steve.

Eric Coleman
Gladiator

USA
809 Posts

Posted - Jun 24 2007 :  10:59:38 AM  Show Profile  Visit Eric Coleman's Homepage  Send Eric Coleman an AOL message  Send Eric Coleman an ICQ Message  Click to see Eric Coleman's MSN Messenger address  Send Eric Coleman a Yahoo! Message  Reply with Quote
make sure the scale mode on the picturebox is set to pixels.

also, make sure the picturebox is visible and created first. In your form_Load event, put "Me.Show" before you try to initialize directx.

Also, the picturebox AutoRedraw might have something to do with it.

Go to Top of Page

STufaro
Neophyte

8 Posts

Posted - Jun 24 2007 :  6:05:45 PM  Show Profile  Send STufaro an AOL message  Reply with Quote
Thanks very much for your reply, Eric!

The bug actually had something to do with the current display mode: you can't set the BackBuffer height/width manually. Since it is WINDOWED (key point), you need to tell DirectX to use the current display mode.

I completely overlooked that.

Thanks again for the reply, though. (Those were all things I checked except for the ScaleMode; I have it set to pixels now as per your suggestion to prevent any future problems).

- Steve.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
VBGamer © Go To Top Of Page
This page was generated in 0.11 seconds. Snitz Forums 2000

Copyright © 2002 - 2004 Eric Coleman, Peter Kuchnio , et. al.