Original Post
🔒 Locked
Dx user control
Advertisement
Quote:
Internal driver error. Applications should generally shut down when receiving this error.
It seems you are doing something that DX or the driver really does not like. Can you get around the problem by doing the same thing in a different way? Otherwise post some code relevant to the error.
protected override void OnResize(EventArgs e)
{
base.OnResize (e);
if(null != renderer)
renderer.ChangeSize();
}
Since its a user control, i presume that its size might change either during design time or if its size is changed using codes. I need to resize the renderer so that it reflect the higher or lower resolution (instead of strecthing, i actually resize them as if changing resolution in game). And also recreate all my resources since stuff that is in video memory will be lost during this resizing. Things works well until i minimized it
When i minimized the program that uses it, this function is called too. (because its being resize until its as small as a title bar like in mdi form?) i did do a width height equal 0 check before resizing but the an exception is thrown before the execution reaches my code. Its in the base.OnResize(e) that cause it to happen
{
base.OnResize (e);
if(null != renderer)
renderer.ChangeSize();
}
Since its a user control, i presume that its size might change either during design time or if its size is changed using codes. I need to resize the renderer so that it reflect the higher or lower resolution (instead of strecthing, i actually resize them as if changing resolution in game). And also recreate all my resources since stuff that is in video memory will be lost during this resizing. Things works well until i minimized it
When i minimized the program that uses it, this function is called too. (because its being resize until its as small as a title bar like in mdi form?) i did do a width height equal 0 check before resizing but the an exception is thrown before the execution reaches my code. Its in the base.OnResize(e) that cause it to happen
I'm just guessing mind you, but maybe the renderer breaks when the size of the control it's rendering to is set to 0,0 (which probably happens in base.OnResize(e) when minimizing). Try checking the resize bounds before calling base.OnResize(e) and disable the renderer when this is the case.
protected override void OnResize(EventArgs e)
{
if (base.ParentForm != null && base.ParentForm.WindowState == FormWindowState.Minimized)
{
return;
}
base.OnResize (e);
if(null != renderer)
renderer.ChangeSize();
}
I put a checking for minimize state just to try it out and i got the same error right after the return statement. has anyone code a user control using dx before?
{
if (base.ParentForm != null && base.ParentForm.WindowState == FormWindowState.Minimized)
{
return;
}
base.OnResize (e);
if(null != renderer)
renderer.ChangeSize();
}
I put a checking for minimize state just to try it out and i got the same error right after the return statement. has anyone code a user control using dx before?
Anwyay i have already found a solution.
protected override void OnResize(EventArgs e)
{
if (base.ParentForm != null && base.ParentForm.WindowState == FormWindowState.Minimized)
{
renderer.Dispose();
return;
}
base.OnResize (e);
if(null != renderer)
renderer.ChangeSize();
}
when a minimized is detected, i just dispose my device (renderer is just a wrapper to it) and return. When the windows is being restore, renderer.ChangeSize() will handle the recreation.
Thanks for the feedback.
protected override void OnResize(EventArgs e)
{
if (base.ParentForm != null && base.ParentForm.WindowState == FormWindowState.Minimized)
{
renderer.Dispose();
return;
}
base.OnResize (e);
if(null != renderer)
renderer.ChangeSize();
}
when a minimized is detected, i just dispose my device (renderer is just a wrapper to it) and return. When the windows is being restore, renderer.ChangeSize() will handle the recreation.
Thanks for the feedback.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement