本文介绍了如何复制新的 DropBox UWP 应用中的窗口透明效果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

显然该效果是创作者更新中引入的一项功能.有没有人想出用于实现这一目标的确切 API?更好的是一些示例代码至少可以帮助我入门.

Apparently the effect is a feature introduced in the Creator's Update. Has anyone figured out the exact APIs used to pull this off? Even better would be some example code to at least help get me started.

任何帮助将不胜感激.:]

Any help would be greatly appreciated. :]

推荐答案

您应该针对 Windows Creators Update 使其工作

You should target Windows Creators Update for it to work

 using Windows.UI.Xaml.Hosting;

 //'this' is MainPage, but can be any UIElement
 var visual = ElementCompositionPreview.GetElementVisual(this);
 var brush = visual.Compositor.CreateHostBackdropBrush();
 var sprite = visual.Compositor.CreateSpriteVisual();
 sprite.Brush = brush;
 //Set to the size of the area, update on SizeChanged
 sprite.Size = new System.Numerics.Vector2(1000, 1000); 
 ElementCompositionPreview.SetElementChildVisual(this, sprite);

这篇关于如何复制新的 DropBox UWP 应用中的窗口透明效果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 20:22