Notify me of new posts by email. This site uses Akismet to reduce spam. Learn how your comment data is processed. Skip to content. FromHandle Game.
Handle as Form; And add a method to add whatever components you want, in this example a MenuStrip and a rendering Panel. SuspendLayout ; windowsGameForm. SuspendLayout ; MainMenu. Point 0, 0 ; MainMenu. Top AnchorStyles. Bottom AnchorStyles. Left AnchorStyles. Note: This example is based on this ZiggyWare tutorial. ZiggyWare should be a must for any XNA or general developer. They have great tutorials.
I've just realized there is another article on this same topic here. It's also a very good approach and handles both ways we discussed previously. Connect and share knowledge within a single location that is structured and easy to search. Okay, so here we go. I'm attempting to make an application, using XNA as the base because of its renderer.
One of the things that is necessary in this project is to open a new window as a dialog , in which is embedded a separate XNA render panel. I'm using this as an interactive preview panel, so I absolutely need XNA to render in there. However, it seems XNA is not very well equipped to do this. I have tried various things myself, but to no avail either producing errors and not rendering correctly, or rendering in the wrong aspect ratio, etc.
Normally, I would post code here, but since I have had such little luck, there isn't much to post. My application currently consists of an XNA application embedded within a Form, and I have a button to open the preview panel, which in theory should pop up as a Form Dialog, containing the XNA renderer, to allow me to draw the preview.
I have been trying this for several hours, and got nowhere, so I'm asking for a bit of help here. Firstly, any textures drawn with a sprite batch appear the right dimensions, but filled with solid black. Also, when I open the dialog, and then close it, and close the application, I get an AccessViolationException. I strongly suspect the two errors are linked in some way. Here is my code initialising the preview dialog.
Note that my main form extends the XNA Game class, for various reasons. This clears the background of the form violet, as expected, and draws a black box of the same size as Image. Active 5 years, 6 months ago. Viewed 8k times. I hope you understand what I asked. Thanks in advance. Edit What's the most important thing for me and wasn't shown in the tutorial of APPHub is: where I have to put the input handling? Improve this question.
Renann Renann 2 2 silver badges 6 6 bronze badges. You will need some control. Like a picturebox to draw the game in. Controls for the game itself would still be managed by XNA. I tried with a picturebox, but I was getting an exception saying that I was running a loop inside another something like that. Add a comment. Active Oldest Votes.
0コメント