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


C# Icon.GetToolkitImage方法代码示例

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


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

示例1: DrawIcon

	// Draw an icon.
	public void DrawIcon(Icon icon, Rectangle targetRect)
			{
				if(icon == null)
				{
					throw new ArgumentNullException("icon");
				}
				if(targetRect.Width == icon.Width &&
				   targetRect.Height == icon.Height)
				{
					// This is the easy case.
					ToolkitDrawIcon(icon, targetRect.X, targetRect.Y);
				}
				else
				{
					// Stretch and draw the image.
					Point[] src = ConvertUnits
						(0, 0, icon.Width, icon.Height, GraphicsUnit.Pixel);
					Point[] dest = ConvertRectangle3
						(targetRect.X, targetRect.Y,
						 targetRect.Width, targetRect.Height, pageUnit);
					BaseOffsetPoints(dest);
					lock(this)
					{
						IToolkitImage toolkitImage = icon.GetToolkitImage(this);
						if(toolkitImage != null)
						{
							ToolkitGraphics.DrawImage
								(toolkitImage, src, dest);
						}
					}
				}
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:33,代码来源:Graphics.cs

示例2: DrawIconUnstretched

	public void DrawIconUnstretched(Icon icon, Rectangle targetRect)
			{
				if(icon == null)
				{
					throw new ArgumentNullException("icon");
				}
				int width = icon.Width;
				int height = icon.Height;
				if(width <= targetRect.Width && height <= targetRect.Height)
				{
					// No truncation is necessary, so use the easy case.
					ToolkitDrawIcon(icon, targetRect.X, targetRect.Y);
				}
				else
				{
					// Only draw as much as will fit in the target rectangle.
					if(width > targetRect.Width)
					{
						width = targetRect.Width;
					}
					if(height > targetRect.Height)
					{
						height = targetRect.Height;
					}
					Point[] src = ConvertUnits
						(0, 0, width, height, GraphicsUnit.Pixel);
					Point[] dest = ConvertRectangle3
						(targetRect.X, targetRect.Y, width, height, pageUnit);
					BaseOffsetPoints(dest);
					lock(this)
					{
						IToolkitImage toolkitImage = icon.GetToolkitImage(this);
						if(toolkitImage != null)
						{
							ToolkitGraphics.DrawImage
								(toolkitImage, src, dest);
						}
					}
				}
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:40,代码来源:Graphics.cs

示例3: ToolkitDrawIcon

	// Draw an unstretched complete icon via the toolkit.
	private void ToolkitDrawIcon(Icon icon, int x, int y)
			{
				lock(this)
				{
					IToolkitImage toolkitImage = icon.GetToolkitImage(this);
					if(toolkitImage != null)
					{
						ConvertPoint(ref x, ref y, pageUnit);
						ToolkitGraphics.DrawImage
							(toolkitImage, x + baseWindow.X,
							 y + baseWindow.Y);
					}
				}
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:15,代码来源:Graphics.cs


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