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


C# BitmapImage.SetValue方法代码示例

本文整理汇总了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);
		}
开发者ID:kangaroo,项目名称:moon,代码行数:5,代码来源:BitmapImageTest.cs

示例2: BadUriSetUriSourceProperty

		public void BadUriSetUriSourceProperty ()
		{
			BitmapImage bitmap = new BitmapImage ();
			bitmap.SetValue (BitmapImage.UriSourceProperty, badUri);
		}
开发者ID:kangaroo,项目名称:moon,代码行数:5,代码来源:BitmapImageTest.cs

示例3: BadUriSetUriSourceProperty

		public void BadUriSetUriSourceProperty ()
		{
			BitmapImage bitmap = new BitmapImage ();
			bitmap.ImageFailed += delegate { /* do nothing */ };
			bitmap.SetValue (BitmapImage.UriSourceProperty, badUri);
		}
开发者ID:dfr0,项目名称:moon,代码行数:6,代码来源:BitmapImageTest.cs

示例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;
		}
开发者ID:adrianph,项目名称:arcgis-toolkit-sl-wpf,代码行数:45,代码来源:FeatureDefinition.cs

示例5: CorruptImageSetUriSourceProperty

		public void CorruptImageSetUriSourceProperty ()
		{
			BitmapImage bitmap = new BitmapImage ();
			bitmap.ImageFailed += delegate { /* do nothing */ };
			bitmap.SetValue (BitmapImage.UriSourceProperty, corruptImage);
		}
开发者ID:dfr0,项目名称:moon,代码行数:6,代码来源:BitmapImageTest.cs


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