本文整理汇总了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.");
}
示例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);
}
}
示例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.");
}
}
}