DoubleBuffer problem ..
-
whenever i use setstyle( ... ) ; and in my paint function i do something like void paintMethod( .., .. ) { using( Graphics g = e.Graphics ) { g.doesSomeDrawing(); } } the ... statements replace the actual code wich is corect i am getting an error message saying "Additional information: Invalid parameter used." and if i don't use the using statement everything works fine .. no error message !:omg: Lazar Mihai Elev clasa XI C Grup Scolar Sanitar
-
whenever i use setstyle( ... ) ; and in my paint function i do something like void paintMethod( .., .. ) { using( Graphics g = e.Graphics ) { g.doesSomeDrawing(); } } the ... statements replace the actual code wich is corect i am getting an error message saying "Additional information: Invalid parameter used." and if i don't use the using statement everything works fine .. no error message !:omg: Lazar Mihai Elev clasa XI C Grup Scolar Sanitar
-
whenever i use setstyle( ... ) ; and in my paint function i do something like void paintMethod( .., .. ) { using( Graphics g = e.Graphics ) { g.doesSomeDrawing(); } } the ... statements replace the actual code wich is corect i am getting an error message saying "Additional information: Invalid parameter used." and if i don't use the using statement everything works fine .. no error message !:omg: Lazar Mihai Elev clasa XI C Grup Scolar Sanitar
You can either not use the using statement, safely, or you can try something like this:
Graphics g = e.Graphics; using ( g ) { g.doesSomeDrawing(); }
RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
whenever i use setstyle( ... ) ; and in my paint function i do something like void paintMethod( .., .. ) { using( Graphics g = e.Graphics ) { g.doesSomeDrawing(); } } the ... statements replace the actual code wich is corect i am getting an error message saying "Additional information: Invalid parameter used." and if i don't use the using statement everything works fine .. no error message !:omg: Lazar Mihai Elev clasa XI C Grup Scolar Sanitar
The answer is simple. The using statement resolves to the following code: try { g.doesSomeDrawing(); } finally { g.Dispose(); } U are disposing a graphics object that u dont "own" (e.graphics). On a general basis you should only dispose graphic objects that you explicitly create through the Control's CreateGraphics() method or through a New Graphics() statement;
-
You can either not use the using statement, safely, or you can try something like this:
Graphics g = e.Graphics; using ( g ) { g.doesSomeDrawing(); }
RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
The actual exception is because the caller of
OnPaint
(most oftenWndProc
) is trying to dispose theGraphics
object and it's already been disposed. He should not be usingusing
at all. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles] [My Blog] -
The actual exception is because the caller of
OnPaint
(most oftenWndProc
) is trying to dispose theGraphics
object and it's already been disposed. He should not be usingusing
at all. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles] [My Blog]I thought it might be something along those lines, wasn't sure though. Too drugged up to think about it and no VS.NET at work to test it with. 8( Let me tell you, life sucks without a compiler at fingertips! RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
I thought it might be something along those lines, wasn't sure though. Too drugged up to think about it and no VS.NET at work to test it with. 8( Let me tell you, life sucks without a compiler at fingertips! RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
I didn't have a compiler. :) Basically, if you didn't alloc it then you don't free it. In native APIs this isn't always the case, though, since some APIs alloc memory and expect the caller to free it. Such APIs should always document such a requirement. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles] [My Blog]
-
I didn't have a compiler. :) Basically, if you didn't alloc it then you don't free it. In native APIs this isn't always the case, though, since some APIs alloc memory and expect the caller to free it. Such APIs should always document such a requirement. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles] [My Blog]
Heath Stewart wrote: Basically, if you didn't alloc it then you don't free it. In native APIs this isn't always the case, I've run into that many a time. :-D I just wanted to try it before I stuck my foot in my mouth. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
The answer is simple. The using statement resolves to the following code: try { g.doesSomeDrawing(); } finally { g.Dispose(); } U are disposing a graphics object that u dont "own" (e.graphics). On a general basis you should only dispose graphic objects that you explicitly create through the Control's CreateGraphics() method or through a New Graphics() statement;
Thanks.. I get it now.. U've all been of great help Lazar Mihai The road to becoming a good programmer is paved with bad scripts !