WinForms application with graphic needs

Started by
3 comments, last by CodeBlocks 15 years, 8 months ago
Hi all, I have a quick question that may not be that easy to answer, I'm not sure. I have a WinForm application that is storing a lot of calculations in a database, as well as basic information like colors, dimensions, etc. Somehow, I need to represent this data in 3D and allow it to change on the fly with changes the user makes. Let's say they want to see a part of the model be blue, I need that model to change. My question is, what is the best way to go about doing this? I am using the 3.5 framework, so I should be able to use the newest technology to do so. Unfortunately, I did not start the project in WPF, just becuase my knowledge there isn't good enough to work on a project this big. Is DirectX the only way to go here? Also I should note, the user should be able to zoom and rotate the model freely, and I would like to have the dimensions on the model. Just need some direction on what technology to use, and the best way to go about it.
Advertisement
Quote:Original post by CodeBlocks
Somehow, I need to represent this data in 3D and allow it to change on the fly with changes the user makes. Let's say they want to see a part of the model be blue, I need that model to change.


Any chance you can explain how this data will be represented in a 3D scene? WPF could be a good candiate for getting your application setup and running quickly. There is a control for Windows Forms to embed WPF content within it. Threfore, you will not need to rewrite your UI. However, as you stated, there will be a bit of a learning curve involved. Microsoft just recently released .NET 3.5 SP1 which includes several new (pretty cool) feature enhancements for the WPF 3D display capabilities.

There is a good video here outlining the new features here: WPF .NET 3.5 SP1 Enhancments (FYI At about 17:58 into the video, he talks about WPF vs DirectX)

Do you know DirectX fairly well? If so, you should not have a problem doing what you want. If your looking at completing this project quickly, you may want to investigate the possibility of using a 3rd party graphics library that wraps DirectX. That way some of the mundane setup tasks are already taken care of for you. If we knew a bit more about your project, we could better recommend a library that suits your needs.

[Edited by - Billr17 on August 17, 2008 10:31:28 PM]
Thanks for the quick response. I admit, I don't know a whole lot about DirectX, I have done some simple apps that just create shapes, but it wasn't something I needed for work, I just spent some time to do some tutorials. I can't say a lot about the project, but imagine maybe an application that estimates and displays a model for a floor layout on a house. If I had a model that was already in the .x format and loaded via direct x, how could I accomplish changing colors to that model through code? This is what is hard for me to picture.

WPF does seem good for this sort of task, maybe wrapping the content up in the 3dContentViewer (or some name similar to that).

Knowing that, what do you believe would be my best option?
WPF does not have any native functionality for importing and displaying .X files. You would need to write your own .X file importer or use a third party library. Microsoft has choosen to only support thier XAML format at this time. As far as I know, this is still true as of the .NET 3.5 SP1 release.

A good example illustarting what you want to do, can be found on the Microsoft XNA website. Check out Color Replacement. In the example, they map an shader to the body of the car model in the .X file. This shader uses an texture to define the areas of the model that should be colorized. Perhaps you could pull an idea or two from this example.
Thanks,

I didn't know that I could blend the XNA with the WinForm applications. I am going to research into it and see if I can make that same effect that the tutorial did. Thanks a lot, any other ideas feel free to post.

This topic is closed to new replies.

Advertisement