本文整理汇总了C#中RectangleF.Intersect方法的典型用法代码示例。如果您正苦于以下问题:C# RectangleF.Intersect方法的具体用法?C# RectangleF.Intersect怎么用?C# RectangleF.Intersect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RectangleF
的用法示例。
在下文中一共展示了RectangleF.Intersect方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Draw
// Draw the elements of the map that lie within the rectange rect
// into the Graphics g, which already has its world coordinates set up
// correctly and the clipping region.
public void Draw(Graphics g, RectangleF rect, RenderOptions renderOpts)
{
CheckReadable();
TraceLine("Begin drawing rectangle ({0},{1})-({2},{3})", rect.Left, rect.Top, rect.Right, rect.Bottom);
Trace.Indent();
GraphicsState graphicsState = g.Save();
GraphicsTarget grTarget = new GraphicsTarget(g);
try {
// Get clipping region and bounding rectangle. If the clipping region isn't a rectangle,
// then it is worth doing extra work to eliminate symbols.
// UNDONE: clipRegionIsRectangle is given false on full repaint. Need to fix this.
Region clipRegion;
rect.Intersect(g.ClipBounds);
clipRegion = g.Clip.Clone();
clipRegion.Xor(rect);
bool clipRegionIsRectangle = clipRegion.IsEmpty(g);
clipRegion.Dispose();
g.TextRenderingHint = TextRenderingHint.AntiAlias;
if (renderOpts.showSymbolBounds)
boundsPen = new Pen(Color.FromArgb(100, Color.Red), 0);
// Draw the image layer.
DrawColor(grTarget, null, rect, clipRegionIsRectangle, renderOpts);
// Draw each color separately, to get correct layering.
foreach (SymColor curColor in colors) {
DrawColor(grTarget, curColor, rect, clipRegionIsRectangle, renderOpts);
}
if (renderOpts.showSymbolBounds)
boundsPen.Dispose();
Trace.Unindent();
}
finally {
g.Restore(graphicsState);
}
}
示例2: IntersectTest
public void IntersectTest(float x, float y, float width, float height)
{
RectangleF rect1 = new RectangleF(x, y, width, height);
RectangleF rect2 = new RectangleF(y, x, width, height);
RectangleF expectedRect = RectangleF.Intersect(rect1, rect2);
rect1.Intersect(rect2);
Assert.Equal(expectedRect, rect1);
Assert.False(rect1.IntersectsWith(expectedRect));
}
示例3: Intersect
// Form the intersection of two rectangles.
public static RectangleF Intersect(RectangleF a, RectangleF b)
{
a.Intersect(b);
return a;
}