本文整理汇总了C#中System.Drawing.Graphics.TranslateClip方法的典型用法代码示例。如果您正苦于以下问题:C# Graphics.TranslateClip方法的具体用法?C# Graphics.TranslateClip怎么用?C# Graphics.TranslateClip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.Graphics
的用法示例。
在下文中一共展示了Graphics.TranslateClip方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TranslateClip
public void TranslateClip(Graphics g)
{
Pen myPen = new Pen(Color.FromArgb(196, 0xC3, 0xC9, 0xCF), (float)0.6);
SolidBrush myBrush = new SolidBrush(Color.FromArgb(127, 0xDD, 0xDD, 0xF0));
// Create the first rectangle and draw it to the screen in blue.
Rectangle regionRect = new Rectangle(100, 50, 100, 100);
g.DrawRectangle(myPen, regionRect);
g.FillRectangle (myBrush, regionRect);
// Create a region using the first rectangle.
Region myRegion = new Region(regionRect);
g.Clip = myRegion;
// Apply the translation to the region.
g.TranslateClip(150, 100);
// Fill the transformed region with red and draw it to the screen in red.
myBrush.Color = Color.FromArgb(127, 0x66, 0xEF, 0x7F);
myPen.Color = Color.FromArgb(255, 0, 0x33, 0);
g.FillRectangle(myBrush, new Rectangle(0,0,500,500) );
}
示例2: DrawImageTranslateClip
void DrawImageTranslateClip(Graphics g)
{
// Create rectangle for clipping region.
var clipRect = new Rectangle (0, 0, 100, 100);
// Set clipping region of graphics to rectangle.
g.SetClip (clipRect);
// Translate clipping region.
int dx = 50;
int dy = 50;
g.TranslateClip (dx, dy);
// Fill rectangle to demonstrate translated clip region.
g.FillRectangle (new SolidBrush (Color.Black), 0, 0, 500, 300);
title = "DrawImageTranslateClip";
}
示例3: Clip
public static void Clip(Graphics g, int time, IGraph graph)
{
ClipPath path1 = graph.ClipPath;
if ((path1 != null) && path1.ShowClip)
{
GraphicsPath path2 = path1.GetGraphicsPath(g, time);
if (path1.ClipPathUnit == Units.ObjectBoundingBox)
{
GraphicsPath path3 = (GraphicsPath) graph.GPath.Clone();
RectangleF ef1 = path3.GetBounds();
float single1 = ef1.Left;
RectangleF ef2 = path3.GetBounds();
float single2 = ef2.Top;
RectangleF ef3 = path3.GetBounds();
float single3 = ef3.Width;
RectangleF ef4 = path3.GetBounds();
float single4 = ef4.Height;
Matrix matrix1 = new Matrix();
matrix1.Scale(single3, single4);
path2.Transform(matrix1);
g.SetClip(path2, CombineMode.Intersect);
g.TranslateClip(single1, single2);
}
else
{
g.SetClip(path2, CombineMode.Intersect);
}
}
}