TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
xuke0518
NA
6
0
Drawing on Label leads to throw exception?
Feb 26 2005 6:08 AM
Usually after drawing stuff on component, I would destroy the Graphics object. Recently I found if i call dispose() on Label Component would lead to throw exception. The exception is System.ArgumentException happens in sytem.drawing.dll. So it forces me not to call dispose() at the end. However dispose() works on other components like Form, Splitter, GroupBox, Panel. It is strange. If anyone knows why, would you please point out? Thanks. //This one leades to throw exception private void label1_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { System.Drawing.Graphics g = e.Graphics; g.DrawLine(Pens.Black,1,1,6,6); e.Dispose(); } // This one is okay private void label1_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { System.Drawing.Graphics g = e.Graphics; g.DrawLine(Pens.Black,1,1,6,6); }
Reply
Answers (
1
)
datetimepicker problem
Using Reflection methods in VB to find design-time Property values