image.Visible = False to free memory?

cyiwin

Active Member
Licensed User
Longtime User
I have 184 imageViews/Labels in one of my Layouts. Each one is assigned a bitmap from inside the Designer. I only need to display maybe 50 of them at a time. Right now I am using the img.Visible = True/False command.

Does anyone know if img.Visible = False frees up the memory that was used for that bitmap?

Or should I be removing the bitmap for each imageView from inside my program when it doesn't need to be displayed? Then I will add the bitmap to each imageView when I want it displayed.
 

cyiwin

Active Member
Licensed User
Longtime User
Ah, I see the answer would be to remove the bitmap from the ImageView. ImageView.RemoveView would remove more than just the bitmap it seems. Is there a way to remove only the bitmap itself from the ImageView? I know I could replace it, I suppose I could replace it with a very small 1x1 pixel bitmap if it is the only way.
 
Upvote 0

cyiwin

Active Member
Licensed User
Longtime User
I may be using it wrong but I got an error with "ImageView.SetBackgroundImage(Null)". Since you informed me of "Null" I was able to do a google and found "ImageView.Bitmap = Null" which seems to work.

Thanks,
Brent
 
Upvote 0

cyiwin

Active Member
Licensed User
Longtime User
Your solution seems to work great with labels, "label.SetBackgroundImage(Null)" which was also helpful to me.
 
Upvote 0
Top