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