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