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


C# IResourceResolver.OpenResource方法代码示例

本文整理汇总了C#中IResourceResolver.OpenResource方法的典型用法代码示例。如果您正苦于以下问题:C# IResourceResolver.OpenResource方法的具体用法?C# IResourceResolver.OpenResource怎么用?C# IResourceResolver.OpenResource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IResourceResolver的用法示例。


在下文中一共展示了IResourceResolver.OpenResource方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FromEmbeddedResource

		/// <summary>
		/// Instantiates an active template from an embedded resource.
		/// </summary>
		/// <param name="resource"></param>
		/// <param name="resolver"></param>
		/// <returns></returns>
		public static ActiveTemplate FromEmbeddedResource(string resource, IResourceResolver resolver)
		{
			using (var stream = resolver.OpenResource(resource))
			{
				using (var reader = new StreamReader(stream))
				{
					return new ActiveTemplate(reader);
				}
			}
		}
开发者ID:m-berkani,项目名称:ClearCanvas,代码行数:16,代码来源:ActiveTemplate.cs

示例2: FlashOverlayController

		/// <summary>
		/// Constructs a controller that uses the 32-bit colour ARGB bitmap specified by the resource name and resource resolver.
		/// </summary>
		/// <param name="resourceName">The partially or fully qualified name of the resource to access.</param>
		/// <param name="resourceResolver">A resource resolver for the resource.</param>
		public FlashOverlayController(string resourceName, IResourceResolver resourceResolver) : this()
		{
			using (Bitmap bitmap = new Bitmap(resourceResolver.OpenResource(resourceName)))
			{
				BitmapData data = bitmap.LockBits(new Rectangle(Point.Empty, bitmap.Size), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
				try
				{
					int length = data.Stride*data.Height;
					_pixelData = new byte[length];
					_rows = data.Height;
					_columns = data.Width;
					Marshal.Copy(data.Scan0, _pixelData, 0, length);
				}
				finally
				{
					bitmap.UnlockBits(data);
				}
			}
		}
开发者ID:nhannd,项目名称:Xian,代码行数:24,代码来源:FlashOverlayController.cs

示例3: FromCursorResource

		private static CursorWrapper FromCursorResource(string cursorResource, IResourceResolver resolver)
		{
			return new CursorWrapper(new Cursor(resolver.OpenResource(cursorResource)), true);
		}
开发者ID:m-berkani,项目名称:ClearCanvas,代码行数:4,代码来源:CursorFactory.cs

示例4: FromImageResource

		private static CursorWrapper FromImageResource(string imageResource, IResourceResolver resolver)
		{
			Bitmap bitmap = new Bitmap(resolver.OpenResource(imageResource));
			IntPtr hIcon = bitmap.GetHicon();

			//we can dispose of the bitmap right away because the icon is a separate resource.
			bitmap.Dispose();

			Cursor cursor = new Cursor(hIcon);
			return new CursorWrapper(cursor, hIcon);
		}
开发者ID:m-berkani,项目名称:ClearCanvas,代码行数:11,代码来源:CursorFactory.cs

示例5: CreateIcon

 /// <summary>
 /// Attempts to create an icon using the specified image resource and resource resolver.
 /// </summary>
 /// <param name="resource">The name of the image resource</param>
 /// <param name="resolver">A resource resolver</param>
 /// <returns>a bitmap constructed from the specified image resource</returns>
 public static Bitmap CreateIcon(string resource, IResourceResolver resolver)
 {
     return new Bitmap(resolver.OpenResource(resource));
 }
开发者ID:m-berkani,项目名称:ClearCanvas,代码行数:10,代码来源:IconFactory.cs

示例6: FlashOverlayController

		/// <summary>
		/// Constructs a controller that uses the 32-bit colour ARGB bitmap specified by the resource name and resource resolver.
		/// </summary>
		/// <param name="resourceName">The partially or fully qualified name of the resource to access.</param>
		/// <param name="resourceResolver">A resource resolver for the resource.</param>
		/// <exception cref="ArgumentNullException">Thrown if <paramref name="resourceName"/> is empty or NULL, or <paramref name="resourceResolver"/> is NULL.</exception>
		public FlashOverlayController(string resourceName, IResourceResolver resourceResolver)
			: this()
		{
			Platform.CheckForEmptyString(resourceName, "resourceName");
			Platform.CheckForNullReference(resourceResolver, "resourceResolver");

			using (Bitmap bitmap = new Bitmap(resourceResolver.OpenResource(resourceName)))
			{
				_pixelData = ExtractBitmap(bitmap, out _rows, out _columns);
			}
		}
开发者ID:m-berkani,项目名称:ClearCanvas,代码行数:17,代码来源:FlashOverlayController.cs


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