当前位置: 首页>>代码示例>>C#>>正文


C# Canvas.SaveAsPngIntoBufferAsync方法代码示例

本文整理汇总了C#中Windows.UI.Xaml.Controls.Canvas.SaveAsPngIntoBufferAsync方法的典型用法代码示例。如果您正苦于以下问题:C# Canvas.SaveAsPngIntoBufferAsync方法的具体用法?C# Canvas.SaveAsPngIntoBufferAsync怎么用?C# Canvas.SaveAsPngIntoBufferAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Windows.UI.Xaml.Controls.Canvas的用法示例。


在下文中一共展示了Canvas.SaveAsPngIntoBufferAsync方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OrientationChanged

 internal async void OrientationChanged(Canvas canvas, Image image)
 {
     if (this.IsReadOnly)
     {
         image.Height = ScreenResolution.HeightWithoutScale;
     }
     else
     {
         this.IsBusy = true;
         BitmapImage attachImage = this.InitialImage;
         double width = attachImage.PixelWidth, height = attachImage.PixelHeight;
         if (Math.Max(attachImage.PixelWidth, attachImage.PixelHeight) > ScreenResolution.HeightWithoutScale)
         {
             if (attachImage.PixelWidth > attachImage.PixelHeight)
             {
                 width = ScreenResolution.HeightWithoutScale;
                 height = ScreenResolution.HeightWithoutScale * ((double)attachImage.PixelHeight / attachImage.PixelWidth);
             }
             else
             {
                 height = ScreenResolution.HeightWithoutScale;
                 width = ScreenResolution.HeightWithoutScale * ((double)attachImage.PixelWidth / attachImage.PixelHeight);
             }
         }
         if (canvas.Children.Any())
         {
             this.ImageBuffer = await canvas.SaveAsPngIntoBufferAsync();
             InitialImage = await ImageBuffer.AsBitmapImageAsync();
             canvas.Background = this.InitialImage.AsImageBrush();
             canvas.Children.Clear();
         }
         canvas.Width = width;
         canvas.Height = height;
         this.IsBusy = false;
     }
 }
开发者ID:bitstadium,项目名称:HockeySDK-Windows,代码行数:36,代码来源:FeedbackAttachmentVM.cs


注:本文中的Windows.UI.Xaml.Controls.Canvas.SaveAsPngIntoBufferAsync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。