L
Lance
I have a couple of dispose questions.
1. Is it advantageous to dispose Drawing.Graphics.Clip
before setting a new clip region? Here is an example:
Dim rect As New Drawing.Rectangle(10, 10, 20, 20)
Dim g As New Drawing.Graphics
g.Clip.Dispose 'Is there any advantage to this line?
g.Clip = New Drawing.Region(rect)
2. Is it necessary to dispose objects that are only
passed as parameters? Here is an example (please ignore
the fact that you could just use Graphics.FillRectangle in
this example):
Sub DrawRectUsingARegion(ByVal g As Drawing.Graphics,
ByVal rect As Drawing.Rectangle)
'Can you do the following?
g.FillRegion(New Drawing.Region(rect))
'Or, should you do this?
Dim rgn As New Drawing.Region(rect)
g.FillRegion(rgn)
rgn.Dispose
End Sub
Thanks!
Lance
1. Is it advantageous to dispose Drawing.Graphics.Clip
before setting a new clip region? Here is an example:
Dim rect As New Drawing.Rectangle(10, 10, 20, 20)
Dim g As New Drawing.Graphics
g.Clip.Dispose 'Is there any advantage to this line?
g.Clip = New Drawing.Region(rect)
2. Is it necessary to dispose objects that are only
passed as parameters? Here is an example (please ignore
the fact that you could just use Graphics.FillRectangle in
this example):
Sub DrawRectUsingARegion(ByVal g As Drawing.Graphics,
ByVal rect As Drawing.Rectangle)
'Can you do the following?
g.FillRegion(New Drawing.Region(rect))
'Or, should you do this?
Dim rgn As New Drawing.Region(rect)
g.FillRegion(rgn)
rgn.Dispose
End Sub
Thanks!
Lance