I have an issue with xna and windows forms. I´ve developed a control with xna, and i used that control inside a windows form. My problem begins when i open a new form and it fully covers the control using xna. When that occurs the cpu usage goes to 50% or more and keeps. But if a small part of the xna control is visible the cpu usage goes down to nornal (1-10% more or less, but not more).
Here is the xna parameters configuration
parameters = new PresentationParameters();
parameters.BackBufferWidth = Math.Max(width, 1);
parameters.BackBufferHeight = Math.Max(height, 1);
parameters.BackBufferFormat = SurfaceFormat.Color;
parameters.DepthStencilFormat = DepthFormat.Depth24;
parameters.DeviceWindowHandle = windowHandle;
parameters.PresentationInterval = PresentInterval.Default;
parameters.IsFullScreen = false;
graphicsDevice = new GraphicsDevice(GraphicsAdapter.DefaultAdapter,
GraphicsProfile.Reach,
parameters);
Thanks in advance.
pd: it is only happening with windows xp. With windows 7 i have no problems.
Well. I solved the issue.
Don´t know why..but it works.
in your custom drawing code of xna at the end i just write: