Reply to thread


System.Drawing.Font fntT = new System.Drawing.Font("Courier New",10);

surPrint.FontHandle = fntT.ToHfont();

surPrint.ForeColor = Color.White;



Hi, the above code is exactly what i use to set the font handle of the surface. This code exsists in the main loop, so for every frame this is executes.

When i run the program it works fine for about a minute or two, until an exception occurs:



An unhandled exception of type System.ArgumentNullException occurred in microsoft.directx.directdraw.dll


Additional information: Value cannot be null.



This is very annoying. Nothing changes in the loop... the same code is executed. As I said before the code works for about 2 minutes then throws this exception.


I commented out the lines dealing with the font handle


System.Drawing.Font fntT = new System.Drawing.Font("Courier New",10);

surPrint.FontHandle = fntT.ToHfont();



And it runs fine without throwing any exceptions at any time.

So Im guessing it has something to do with the font handle.

But it works fine for 2 mins :confused:.


Btw, because of what I have planned, I need to set the font handle every time it loops. So setting it before the loop begins is not an option for me. I hope this is not an internal error that is out of my reach, that would suck.


Any ideas / suggestions

thanx in advanced.


Back
Top