Fork Me On Github

加阴影

var bitmap = new CanvasRenderTarget(Control, (float)Width,
                   (float)Height, 96);
var effect = new Transform2DEffect() {
    Source = new ShadowEffect()
    {
        Source = bitmap,
        BlurAmount = 2,
    },
    TransformMatrix = Matrix3x2.CreateTranslation(3, 3)
};



private void DrawerCanvas_Draw(Microsoft.Graphics.Canvas.UI.Xaml.CanvasControl sender, Microsoft.Graphics.Canvas.UI.Xaml.CanvasDrawEventArgs args)
{
    args.DrawingSession.DrawImage(effect);
}

无论内容是什么输出的时一个黑色的框框带阴影效果,

应该加代码输出原版的图像,即可

private void DrawerCanvas_Draw(Microsoft.Graphics.Canvas.UI.Xaml.CanvasControl sender, Microsoft.Graphics.Canvas.UI.Xaml.CanvasDrawEventArgs args)
{
    args.DrawingSession.DrawImage(effect);
    args.DrawingSession.DrawImage(bitmap);
}
点击查看全文
标签: uwp
0 12 0
win2d使用
UWP Custom Control自定义控件开发
uwp应用获取应用内的文件内容
UWP 使用语言包
2020年04月
UWP 上传图片
2020年04月
UWP 怎么上传图片