View Single Post
  #3 (permalink)  
Old 07-09-2009, 10:07 AM
scdevils2 scdevils2 is offline
VB.NET Forum Newbie
.NET Framework: .NET 2.0
 
Join Date: Jun 2007
Posts: 7
Reputation: 0
scdevils2 is on a distinguished programming path ahead
Default

yes, I know you have to dispose of the image after the use, I was commenting out the code trying to figure out what was going on.

So I tried Saving the Image to demonstrate what I am seeing, however, when i save the image, the image does not display incorrectly any more.

Code:
    Private Function getBitMap(ByVal BottomImage As Bitmap, ByVal CloneFirst As Boolean) As Bitmap

        Dim CopiedBottomImage As Bitmap = DirectCast(BottomImage.Clone(), Bitmap)
        Dim CopiedImageGraphics As Graphics
        Dim otherImage As Bitmap


        If CloneFirst Then
            otherImage = DirectCast(BottomImage.Clone(), Bitmap)
            CopiedImageGraphics = Graphics.FromImage(CopiedBottomImage)
        Else
            CopiedImageGraphics = Graphics.FromImage(CopiedBottomImage)
            otherImage = DirectCast(BottomImage.Clone(), Bitmap)
        End If

        otherImage.Dispose()
        CopiedImageGraphics.Dispose()
        'Fixes the Problem
        CopiedBottomImage.Save(SAVE_IMAGE_PATH)
        Return CopiedBottomImage
    End Function
Reply With Quote