本文整理匯總了C#中System.Windows.Media.Imaging.BitmapImage.SetValue方法的典型用法代碼示例。如果您正苦於以下問題:C# BitmapImage.SetValue方法的具體用法?C# BitmapImage.SetValue怎麽用?C# BitmapImage.SetValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Windows.Media.Imaging.BitmapImage
的用法示例。
在下文中一共展示了BitmapImage.SetValue方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: CorruptImageSetUriSourceProperty
public void CorruptImageSetUriSourceProperty ()
{
BitmapImage bitmap = new BitmapImage ();
bitmap.SetValue (BitmapImage.UriSourceProperty, corruptImage);
}
示例2: BadUriSetUriSourceProperty
public void BadUriSetUriSourceProperty ()
{
BitmapImage bitmap = new BitmapImage ();
bitmap.SetValue (BitmapImage.UriSourceProperty, badUri);
}
示例3: BadUriSetUriSourceProperty
public void BadUriSetUriSourceProperty ()
{
BitmapImage bitmap = new BitmapImage ();
bitmap.ImageFailed += delegate { /* do nothing */ };
bitmap.SetValue (BitmapImage.UriSourceProperty, badUri);
}
示例4: GetIconImage
/// <summary>
/// Returns the bitmap image brush associated with the icon href for the point feature.
/// </summary>
/// <param name="IconHref">Value used to obtain image from remote server via HTTP or key for image dictionary.</param>
/// <returns>
/// A bitmap image brush or null if not found.
/// </returns>
private ImageBrush GetIconImage(string IconHref)
{
Uri imageUri = KmlLayer.GetUri(IconHref, _baseUri);
// If the imageUri is OK then use it. Otherwise return null
// so that a SimpleMarkerSymbol is created.
if (imageUri != null
#if SILVERLIGHT
&& (imageUri.Scheme == "http" || imageUri.Scheme == "https")
#endif
)
{
// Since this is accessing a remote server which may be down or otherwise inaccessible, use
// exception handling to consume the error and fail quietly, falling through to fallback logic
// and returning null otherwise.
try
{
#if SILVERLIGHT
// Create bitmap image, set creation options to None so image creation is not delayed
// and use URI to get image.
BitmapImage bi = new BitmapImage();
bi.SetValue(BitmapImageKeyProperty, IconHref);
bi.CreateOptions = BitmapCreateOptions.None;
bi.UriSource = imageUri;
return new ImageBrush { ImageSource = bi };
#else
BitmapImage bi = new BitmapImage(imageUri);
bi.SetValue(BitmapImageKeyProperty, IconHref);
return new ImageBrush { ImageSource = bi };
#endif
}
catch
{
}
}
return null;
}
示例5: CorruptImageSetUriSourceProperty
public void CorruptImageSetUriSourceProperty ()
{
BitmapImage bitmap = new BitmapImage ();
bitmap.ImageFailed += delegate { /* do nothing */ };
bitmap.SetValue (BitmapImage.UriSourceProperty, corruptImage);
}