简体   繁体   中英

how to set/change canvasBitmap height and width in win2d UWP?

What I have tried is?

CanvasBitmap CanvasBitmap = await CanvasBitmap.LoadAsync(sender,@"Assets\xyz.png");
CanvasBitmap.Size.Height = 100;
CanvasBitmap.Size.Width = 300;
args.DrawingSession.DrawImage(CanvasBitmap,Vector);

but I can't change the width and height of canvasbitmap.I need to change the Width and height of drawable image dynamically in runtime.Can anyone help me?I Don't want to change canvasControl width and height!!

You can't do that.

But what you can do is, you can apply scaling to the bitmap:

CanvasBitmap CanvasBitmap = await CanvasBitmap.LoadAsync(sender,@"Assets\xyz.png");
args.DrawingSession.Transform = Matrix3x2.CreateScale(2);
args.DrawingSession.DrawImage(CanvasBitmap,Vector);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM