本文整理汇总了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);
}
}
}
}
示例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);
}
}
}
}
示例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);
}
}
}