■ SpriteVisual 클래스의 Size/Offset/Brush/Shadow 속성을 사용하는 방법을 보여준다.
▶ 예제 코드 (C#)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
using System.Numerics; using Microsoft.UI; using Microsoft.UI.Composition; using Microsoft.UI.Xaml.Hosting; // ... Grid grid; // ... Visual gridVisual = ElementCompositionPreview.GetElementVisual(this.grid); Compositor compositor = gridVisual.Compositor; CompositionColorBrush compositionColorBrush = compositor.CreateColorBrush(Colors.Blue); DropShadow dropShadow = compositor.CreateDropShadow(); dropShadow.BlurRadius = 15.0f; dropShadow.Offset = new Vector3(10, 10, 0); dropShadow.Color = Colors.Black; SpriteVisual spriteVisual = compositor.CreateSpriteVisual(); spriteVisual.Size = new Vector2(200, 200); spriteVisual.Offset = new Vector3(100, 100, 0); spriteVisual.Brush = compositionColorBrush; spriteVisual.Shadow = dropShadow; |