Search code examples
c#xnawindowspritebatch

When I change vertical size of XNA game window to minimum, it throws ObjectDisposedException for spritebatch, why?


When I resize the game window and the viewport's height becomes 0, GC disposes of spritebatch, I think. Is this what happens? How do I prevent this?


Solution

  • Form gameForm = (Form)Form.FromHandle(Window.Handle);
    gameForm.MinimumSize = new System.Drawing.Size(800, 600);
    

    Short and sweet!