LoadedImageSurface.Close 方法

定义

释放 LoadedImageSurface 和关联的资源。

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

实现

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

示例

在此示例中,即使 LoadedImageSurface 已关闭,CompositionSurfaceBrush 仍将存在。

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

注解

调用此方法将释放 LoadedImageSurface 引用,但从 LoadedImageSurface 创建的仍具有活动引用的任何画笔或图面将继续呈现,除非也显式释放这些画笔或图面。

适用于