Visual Basic (Declaration) | |
---|---|
<DescriptionAttribute("Automatically disposes the item images when them item is removed from the control or when the control is disposed.")> <CategoryAttribute("Behavior")> Public Property AutoDisposeImages As Boolean |
Visual Basic (Usage) | Copy Code |
---|---|
|
C# | |
---|---|
[DescriptionAttribute("Automatically disposes the item images when them item is removed from the control or when the control is disposed.")] [CategoryAttribute("Behavior")] public bool AutoDisposeImages {get; set;} |
Managed Extensions for C++ | |
---|---|
[DescriptionAttribute("Automatically disposes the item images when them item is removed from the control or when the control is disposed.")] [CategoryAttribute("Behavior")] public: __property bool get_AutoDisposeImages(); public: __property void set_AutoDisposeImages( bool value ); |
C++/CLI | |
---|---|
[DescriptionAttribute("Automatically disposes the item images when them item is removed from the control or when the control is disposed.")] [CategoryAttribute("Behavior")] public: property bool AutoDisposeImages { bool get(); void set (bool value); } |
Return Value
true to automatically dispose item images; false, otherwise. Default value is true.This example removes an item from the control and demonstrates how the AutoDisposeImages property effects whether the item image remains usable.
Visual Basic | Copy Code |
---|---|
Public Sub RasterImageList_AutoDisposeImages(ByVal imageList As RasterImageList) |
C# | Copy Code |
---|---|
public void RasterImageList_AutoDisposeImages(RasterImageList imageList) |
When the value of the AutoDisposeImages is set to true, the RasterImageList control will automatically call the RasterImage.Dispose method on an item's RasterImageListItem.Image when the item is removed from the Items collection or when the control itself is disposed.
The control will check if an image is used with multiple items (for example, if multiple items are using the same image but to show different pages). In this case, the control will correctly dispose the image only once.
If you setup the items with images that you do not want to dispose of and are going to re-use somewhere else, you need to set the value of the AutoDisposeImages property of the RasterImageList control to false.
You can also temporarily change the value of the AutoDisposeImages property if you want to save the item image before you dispose it. For example, set the AutoDisposeImages property to false, call Remove on the Items collection to remove the item, then re-set the AutoDisposeImages property back to true.
Note that if you set the AutoDisposeImages value to false and you do not dispose the item images youself, the .NET garbage collector will eventually detect that these images are not used anymore and will dispose them for you when the control and any other reference to these images are no longer used in your application.
Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family