Dela via


LoadedImageSurface.Close Method

Definition

Disposes of the LoadedImageSurface and associated resources.

public:
 virtual void Close() = Close;
void Close();
// This member is not implemented in C#
function close()
' This member is not implemented in VB.NET

Implements

M:Windows.Foundation.IClosable.Close M:System.IDisposable.Close

Examples

In this example, the CompositionSurfaceBrush will continue to exist even after the LoadedImageSurface has been closed.

Compositor compositor = new Compositor();
CompositionSurfaceBrush imageBrush = compositor.CreateSurfaceBrush();

LoadedImageSurface loadedSurface = LoadedImageSurface.StartLoadFromUri(new Uri("ms-appx:///Assets/myPic.jpg"));
loadedSurface.LoadCompleted += Load_Completed;
imageBrush.Surface = loadedSurface;

loadedSurface.Close();
// The imageBrush still exists

Remarks

Calling this method will dispose the LoadedImageSurface reference, however any brushes or surfaces created from the LoadedImageSurface that still have active references will continue to render unless you explicitly dispose of those as well.

Applies to