Tuesday, July 26, 2016

xna 4.0 - How to get file paths in XNA 4.0?


Is it possible to use OpenFileDialog in XNA 4.0 to get the file path? If not, what is the alternative? I'm using XNA 4.0 to create a graphic display (not a game) and I have a file that contains informations on how and what to draw on screen. The only problem is that I hard-coded the path because I don't know how to dynamically get that path? Do you know a solution for that?



Answer




Just put the Attribute [STAThread] above the Main method in the class Program and add the System.Windows.Forms in the References of the project.


After that you'll be able to instantiate and invoke the dialog boxes.


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...