当前位置: 首页>>代码示例>>C#>>正文


C# RectangleF.Intersect方法代码示例

本文整理汇总了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);
            }
        }
开发者ID:jonc,项目名称:carto,代码行数:45,代码来源:Map.cs

示例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));
 }
开发者ID:geoffkizer,项目名称:corefx,代码行数:9,代码来源:RectangleFTests.cs

示例3: Intersect

	// Form the intersection of two rectangles.
	public static RectangleF Intersect(RectangleF a, RectangleF b)
			{
				a.Intersect(b);
				return a;
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:6,代码来源:RectangleF.cs


注:本文中的RectangleF.Intersect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。