Re: Graphics.TextRenderingHint throw exception?
- From: "schneider" <eschneider.news.ms@xxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 6 Mar 2008 13:58:08 -0600
I can't post all the code, there is just too much.
My initial assumtion was that a state on Graphics was change by me, which
caused this problem, and was hoping some one had experience with that
problem and how to fix it. I have seen this before when drawing text.
I think I have narrowed it down to the control resize event and the control
on_paint event.
I think your correct that the owner is disposing it before I am done
drawing.
If a new paint event is triggered, does it dispose the previous graphics
object right away? If so that is probably my problem...
Thanks,
Schneider
"Bob Powell [MVP]" <bob@xxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:u0$Oo%236fIHA.2000@xxxxxxxxxxxxxxxxxxxxxxx
I bet you're caching one you've been given.
The owner will call dispose on it an you'll be left with a disposed
reference.
Don't cache Graphics objects.
Mind you, if you just posted all the code instead of feeding us snippets
and frustration we'd be able to see and point out the mistakes instead of
having to get the ideas through a process of divination...
--
Bob Powell [MVP]
Visual C#, System.Drawing
Ramuseco Limited .NET consulting
http://www.ramuseco.com
Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
schneider wrote:
I still can't figure this out. Some how I invalidate the Graphics object.
Graphics.Save
Graphics.TextRenderHint
Graphics.MeasureString
all throw ArgumentException "Parameter is not valid.", and I'm not
disposing it.
Anyone have any ideas?
Thanks,
Schneider
"schneider" <eschneider@xxxxxxxxxxxxx> wrote in message
news:OJ1JATweIHA.3724@xxxxxxxxxxxxxxxxxxxxxxx
Under some cases Graphics.TextRenderingHint and also Graphics.Save
throws an exception?
I can't seem to understand why. or what I'm doing wrong? and the error
message is useless.
Anyone know whats going on?
Thanks
Schneider
.
- References:
- Re: Graphics.TextRenderingHint throw exception?
- From: schneider
- Re: Graphics.TextRenderingHint throw exception?
- From: Bob Powell [MVP]
- Re: Graphics.TextRenderingHint throw exception?
- Prev by Date: Re: String drawing gives me headache... advise very welcome
- Next by Date: on-screen overlay connections : looking for the medium-priced solution
- Previous by thread: Re: Graphics.TextRenderingHint throw exception?
- Next by thread: Re: Loss of precision when drawing gridlines and blocks on top.....
- Index(es):
Relevant Pages
|