Xbox LIVE Indie Games
Sort Discussions: Previous Discussion Next Discussion
Page 1 of 1 (6 posts)

Running XNA framework in a windows form control

Last post 2/22/2012 3:20 PM by adigostin. 5 replies.
  • 3/3/2011 10:44 AM In reply to

    Re: Running XNA framework in a windows form control - multiple graphics control problem

    The GraphicsDeviceControl class is just what I was looking for. It works a treat, except that I eventually get memory errors when I try draw a texture in one control that was created for another control (even though the controls share the same graphics hardware). The texture does get drawn correctly on the second control, but a memory error occurs eventually - if I draw again, or close the form.
  • 3/3/2011 1:49 PM In reply to

    Re: Running XNA framework in a windows form control - multiple graphics control problem

    Having investigated further, it might be because I used the standard XNA window's graphics device to create a texture, which then causes problems when drawn onto a GraphicsDeviceControl. So I am biting the bullet, and rewriting my application to use GraphicsDeviceControls only .....
  • 5/23/2011 10:14 PM In reply to

    Re: Running XNA framework in a windows form control

    I'm glad I found this buried here in the forums, I've been trying to construct a level editor for a while and was making a clumsy attempt of it using XNA only for the GUI.

    However...

    The graphics device controls on my windows form keep vanishing after I have been working on another form element unrelated to the graphics device control.

    For example:
    I add a graphics device control into the body of a tab form, and set it up to display a simple texture2D type - if I test it at this point it works fine.
    I then add a combiBox to the form, do some work on it like manually adding in list text (I was trying to get the list from a set of dictionary keys - but that is another topic)
    All looks well, I click off to edit the form code (not the designer code) and when I return my sprite control no longer exists.
    When I review the form designer code, my sprite control is no longer one of the items initialised, however the object declaration is still there.

    Just to make it more confusing this doesn't happen every time, I think it may be to do with which parts of an element I am updating properties to. Sometimes the control is visible on the form but can no longer be selected.

    The only work around I can think of is to add my graphics device controls at the end, which doesn't help me with testing each one as I do it.

    Am I missing something really obvious here? Truth be told it has been ages sinced I have worked with forms.

    J
  • 2/20/2012 9:48 AM In reply to

    Re: Running XNA framework in a windows form control

    I've been trying to build the WinFormsGraphicsSample_4_0 for like an hour. I keep getting

    Error loading pipeline assembly "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll".

    Tried various solutions I found on the internet, tried playing with references etc etc. Simply won't build :(
  • 2/22/2012 3:20 PM In reply to

    Re: Running XNA framework in a windows form control

    Fixed it!
    I incidentally came across a corrupted System.dll file in the GAC and I recalled the "System.dll" problem I described above. Reinstalling the .NET Framework  solved everything.

    (BTW: Reinstalling .NET Framework 4 was another nuisance, as the web installer wouldn't work cause "it's already installed and can't proceed", and the Control Panel applet would ask me for some .msi file which I never had or used......)
Page 1 of 1 (6 posts) Previous Discussion Next Discussion