View Single Post
  #2 (permalink)  
Old 07-09-2009, 9:57 AM
JohnH's Avatar
JohnH JohnH is offline
VB.NET Forum Moderator
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Dec 2005
Location: Norway
Age: 37
Posts: 10,303
Reputation: 1315
JohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond repute
Default

Quote:
If I set CloneFirst =True, the image is displayed as expected. If i Set CloneFirst =False the image is displayed pixelated.
I don't see how, your getBitMap method returns BottomImage.Clone no matter what CloneFirst parameter is.
Quote:
Are Cloned Images Disjoint From original Image?
Yes.

You have commented out some Dispose calls here, Graphics instances created from FromImage must be disposed when done using them, image/bitmap objects must also be disposed after use. So otherImage.Dispose() and CopiedImageGraphics.Dispose() is needed in getBitMap method. In btnDisplay_Click method you need to dispose the image object held by newBitMap variable, and if pbImage.Image already contains an image you must dispose that before assigning it a new image object. imageFile.OpenRead returns a FileStream object, you have to close/dispose this when done using it also. In general you have to analyse your code to make sure you don't open/create objects and just leave them in memory after last reference is released without disposing/closing them properly.
__________________
Reply With Quote