Post

 Resources 

Console

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

 All Forums
 VBGamer
 VBGamer
 D3D in PictureBox control

Note: You must be registered in order to post a reply.

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List Spell Checker
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

   Insert an File
Check here to include your profile signature.
Check here to subscribe to this topic.
    

T O P I C    R E V I E W
STufaro Posted - Jun 18 2007 : 10:19:32 AM
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.
2   L A T E S T    R E P L I E S    (Newest First)
STufaro Posted - Jun 24 2007 : 6:05:45 PM
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.
Eric Coleman Posted - Jun 24 2007 : 10:59:38 AM
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.

VBGamer © Go To Top Of Page
This page was generated in 0.06 seconds. Snitz Forums 2000

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