當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。