Jump to content
  • Advertisement
Sign in to follow this  
programmermattc

Embedding Graphics in a Windows Form (Tools Programming)

This topic is 3683 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

I'm working on a tile map editor and would like to have a part of the window show an actual representation of the map where you can lay down tiles. I'd also like a list box type item that has the tiles in it. From what I've seen online drawing DirectX to a portion of a form seems quite difficult. Also, I've heard some people suggest System.Drawing instead. Does anyone have any experience/suggestions for building a game tool like this? Any help is greatly appreciated. [Edited by - programmermattc on July 14, 2008 1:36:48 PM]

Share this post


Link to post
Share on other sites
Advertisement
Using DirectX to draw to a form is not difficult at all. All you need is the Handle property of the form to pass to DirectX. If you can stay with all managed code, I'd recommend checking out SlimDX, which is how you can access DirectX from managed code.

Share this post


Link to post
Share on other sites
As Mike said, rendering to a part of the window is pretty easy.

I just took about 2 minutes and changed my renderer constructor to accept a Control instead of a WinForm, and then I just added a PictureBox (any Control derived class should work) to the form I was rendering to, passed the PictureBox control to the renderer, and voilà, my game was rendering to the PictureBox which was about 1/3 the size of the WinForm.

I imagine you could switch between rendering to different Controls just as easily. I'm not sure what you'd have to do for reconstructing the device when you change Handles though, haven't done that myself.

I'm using C#/SlimDX for my game projects, it's pretty smooth.

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!