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


C# WriteableBitmap.SaveToMediaLibrary方法代码示例

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


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

示例1: Button_Click

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Screenshot.Children.Remove(textBlock1);
            Screenshot.Children.Remove(textBlock2);

            textBlock1.Text = textBox1.Text;
            textBlock2.Text = textBox2.Text;

            Screenshot.Children.Remove(textBox1);
            Screenshot.Children.Remove(textBox2);

            Screenshot.Children.Remove(memeImage);

            textBlock1.Margin = new Thickness(0, 0, 0, 350);
            textBlock2.Margin = new Thickness(0, 350, 0, 0);
            //textBlock1.Height = 78;
            //textBlock2.Height = 78;
            textBlock1.VerticalAlignment = VerticalAlignment.Top;
            textBlock2.VerticalAlignment = VerticalAlignment.Bottom;
            textBlock1.HorizontalAlignment = HorizontalAlignment.Center;
            textBlock2.HorizontalAlignment = HorizontalAlignment.Center;
            textBlock1.TextAlignment = TextAlignment.Center;
            textBlock2.TextAlignment = TextAlignment.Center;
            textBlock1.Width = Screenshot.ActualWidth;
            textBlock2.Width = Screenshot.ActualWidth;
            textBlock1.FontSize = 40;
            textBlock2.FontSize = 40;
            textBlock1.FontFamily = new FontFamily("Arial");
            textBlock2.FontFamily = new FontFamily("Arial");
            textBlock1.FontWeight = FontWeights.ExtraBold;
            textBlock2.FontWeight = FontWeights.ExtraBold;

            Screenshot.Children.Add(memeImage);
            Screenshot.Children.Add(textBlock1);
            Screenshot.Children.Add(textBlock2);

            /*****************************************************************************************************/

            WriteableBitmap wb = null;
            while ((wb = new WriteableBitmap(Screenshot, null)) == null) ;
            wb.Invalidate();

            wb.SaveToMediaLibrary("meme" + memeSelected, false);

            MessageBox.Show("Your meme is saved.");
        }
开发者ID:SeanDunford,项目名称:WinPhoneSandBox,代码行数:46,代码来源:Page2.xaml.cs

示例2: OnSaveClick

        private void OnSaveClick(object sender, RoutedEventArgs e) {
            if (media.Constructor == Constructor.messageMediaPhoto) {
                WriteableBitmap wbm = new WriteableBitmap(_bitmap);

                Photo photo = ((MessageMediaPhotoConstructor)media).photo;
                if (photo.Constructor != Constructor.photo)
                    return;

                PhotoConstructor photoCons = (PhotoConstructor) photo;

                wbm.SaveToMediaLibrary(photoCons.caption == "" ? Helpers.GenerateRandomUlong().ToString("X") : photoCons.caption);
            }
        }
开发者ID:Grief-Code,项目名称:kilogram,代码行数:13,代码来源:MediaViewPage.xaml.cs

示例3: appbar_save_Click

 //User can save doodle if full version
 private void appbar_save_Click(object sender, EventArgs e)
 {
     if (licenseInfo.IsTrial())
     {
         MessageBox.Show("Saving is unavailable in Trial Mode.");
     }
     else
     {
         WriteableBitmap bitmap = new WriteableBitmap(LayoutRoot, null);
         var name = String.Format("DoodlePad_{0:yyyy-MM-dd_hh-mm-ss-tt}.jpg", DateTime.Now);
         try
         {
             bitmap.SaveToMediaLibrary(name);
             MessageBox.Show("Doodle successfully saved as '" + name + "'!");
         }
         catch (Exception ex)
         {
             MessageBox.Show("Sorry, unable to save your Doodle at this time. Make sure the phone is disconnected from your PC.");
         }
     }
 }
开发者ID:disbitski,项目名称:DoodlePad,代码行数:22,代码来源:MainPage.xaml.cs


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