本文整理汇总了C#中System.Drawing.Graphics.BeginContainer方法的典型用法代码示例。如果您正苦于以下问题:C# Graphics.BeginContainer方法的具体用法?C# Graphics.BeginContainer怎么用?C# Graphics.BeginContainer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.Graphics
的用法示例。
在下文中一共展示了Graphics.BeginContainer方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BeginContainerVoid
private void BeginContainerVoid(PaintEventArgs e)
{
// Begin graphics container.
GraphicsContainer containerState = e.Graphics.BeginContainer();
// Translate world transformation.
e.Graphics.TranslateTransform(100.0F, 100.0F);
// Fill translated rectangle in container with red.
e.Graphics.FillRectangle(new SolidBrush(Color.Red), 0, 0, 200, 200);
// End graphics container.
e.Graphics.EndContainer(containerState);
// Fill untransformed rectangle with green.
e.Graphics.FillRectangle(new SolidBrush(Color.Green), 0, 0, 200, 200);
}
示例2: BeginContainerRectangle
private void BeginContainerRectangle(PaintEventArgs e)
{
// Define transformation for container.
Rectangle srcRect = new Rectangle(0, 0, 200, 200);
Rectangle destRect = new Rectangle(100, 100, 150, 150);
// Begin graphics container.
GraphicsContainer containerState = e.Graphics.BeginContainer(
destRect, srcRect,
GraphicsUnit.Pixel);
// Fill red rectangle in container.
e.Graphics.FillRectangle(new SolidBrush(Color.Red), 0, 0, 200, 200);
// End graphics container.
e.Graphics.EndContainer(containerState);
// Fill untransformed rectangle with green.
e.Graphics.FillRectangle(new SolidBrush(Color.Green), 0, 0, 200, 200);
}
示例3: BeginContainerRectangleF
private void BeginContainerRectangleF(PaintEventArgs e)
{
// Define transformation for container.
RectangleF srcRect = new RectangleF(0.0F, 0.0F, 200.0F, 200.0F);
RectangleF destRect = new RectangleF(100.0F, 100.0F, 150.0F, 150.0F);
// Begin graphics container.
GraphicsContainer containerState = e.Graphics.BeginContainer(
destRect, srcRect,
GraphicsUnit.Pixel);
// Fill red rectangle in container.
e.Graphics.FillRectangle(new SolidBrush(Color.Red), 0.0F, 0.0F, 200.0F, 200.0F);
// End graphics container.
e.Graphics.EndContainer(containerState);
// Fill untransformed rectangle with green.
e.Graphics.FillRectangle(new SolidBrush(Color.Green), 0.0F, 0.0F, 200.0F, 200.0F);
}