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


C# RectangleF.Intersect方法代码示例

本文整理汇总了C#中System.Drawing.RectangleF.Intersect方法的典型用法代码示例。如果您正苦于以下问题:C# RectangleF.Intersect方法的具体用法?C# RectangleF.Intersect怎么用?C# RectangleF.Intersect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Drawing.RectangleF的用法示例。


在下文中一共展示了RectangleF.Intersect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DrawRect

		public void DrawRect(RectangleF aRect, bool selected)
		{
			NSGraphics.RectClip (aRect);
			
			aRect.Intersect (Frame);
			
			Color.Set ();
			NSGraphics.RectFill (aRect);
			
		    if (selected) {
		        NSColor.Black.Set ();
		        NSGraphics.FrameRectWithWidth (Frame, 4.0f);
		    }
			
			if (IsLocked){
				float xSize = (Frame.Width > 10.0f) ? 5.0f : 3.0f;
				
				NSBezierPath path = NSBezierPath.CreateBezierPath ();
				
				NSColor.Black.Set ();
				path.LineWidth = 3.0f;
				path.MoveTo (new PointF (MidX (Frame) - xSize, MidY (Frame) - xSize));
				path.LineTo (new PointF (MidX (Frame) + xSize, MidY (Frame) + xSize));
				path.MoveTo (new PointF (MidX (Frame) - xSize, MidY (Frame) + xSize));
				path.LineTo (new PointF (MidX (Frame) + xSize, MidY (Frame) - xSize));
				path.Stroke ();
				
			}
	
		}
开发者ID:jamiebriant,项目名称:monomac,代码行数:30,代码来源:ColorRect.cs

示例2: CalculateIntersectPercentage

        public static float CalculateIntersectPercentage(RectangleF rect, RectangleF referenceRect)
        {
            if (rect.IsEmpty || referenceRect.IsEmpty) return 0;

            referenceRect.Intersect(rect); // replace referenceRect with intersect
            return referenceRect.IsEmpty ? 0 : (referenceRect.Width * referenceRect.Height) / (rect.Width * rect.Height);
        }
开发者ID:PeterMortensen,项目名称:CUE.NET,代码行数:7,代码来源:RectangleHelper.cs

示例3: Draw

		public override void Draw (RectangleF rect)
		{
			using (var context = UIGraphics.GetCurrentContext ()) {

				// get the scale from the context by getting the current transform matrix, then asking for
				// its "a" component, which is one of the two scale components. We could also ask for "d".
				// This assumes (safely) that the view is being scaled equally in both dimensions.
				var scale = context.GetCTM ().xx;
				CATiledLayer tiledLayer = (CATiledLayer)this.Layer; 
				var tileSize = tiledLayer.TileSize;

				// Even at scales lower than 100%, we are drawing into a rect in the coordinate system of the full
				// image. One tile at 50% covers the width (in original image coordinates) of two tiles at 100%. 
				// So at 50% we need to stretch our tiles to double the width and height; at 25% we need to stretch 
				// them to quadruple the width and height; and so on.
				// (Note that this means that we are drawing very blurry images as the scale gets low. At 12.5%, 
				// our lowest scale, we are stretching about 6 small tiles to fill the entire original image area. 
				// But this is okay, because the big blurry image we're drawing here will be scaled way down before 
				// it is displayed.)
				tileSize.Width /= scale;
				tileSize.Height /= scale;

				// calculate the rows and columns of tiles that intersect the rect we have been asked to draw
				int firstCol = (int)Math.Floor (rect.GetMinX () / tileSize.Width);
				int lastCol = (int)Math.Floor ((rect.GetMaxX () - 1) / tileSize.Width);
				int firstRow = (int)Math.Floor (rect.GetMinY () / tileSize.Height);
				int lastRow = (int)Math.Floor ((rect.GetMaxY () - 1) / tileSize.Height);

				for (int row = firstRow; row <= lastRow; row++) {
					for (int col = firstCol; col <= lastCol; col++) {
					 
						UIImage tile = TileForScale (scale, row, col);
						var tileRect = new RectangleF (tileSize.Width * col, tileSize.Height * row, tileSize.Width, tileSize.Height);
						// if the tile would stick outside of our bounds, we need to truncate it so as to avoid
						// stretching out the partial tiles at the right and bottom edges
						tileRect.Intersect (this.Bounds);
						tile.Draw (tileRect);
					}
				}
			}
		}
开发者ID:GSerjo,项目名称:monotouch-samples,代码行数:41,代码来源:TilingView.cs

示例4: FwInvertRect

		/// -----------------------------------------------------------------------------------
		/// <summary>Member FwInvertRect</summary>
		/// <param name='xLeft'>xLeft</param>
		/// <param name='yTop'>yTop</param>
		/// <param name='xRight'>xRight</param>
		/// <param name='yBottom'>yBottom</param>
		/// -----------------------------------------------------------------------------------
		public void FwInvertRect(int xLeft, int yTop, int xRight, int yBottom)
		{
			Debug.Assert(m_bitmapGraphics != null);
			RectangleF rc = new RectangleF(xLeft, yTop, xRight - xLeft,
				yBottom - yTop);

			if (!rc.IntersectsWith(m_bitmapGraphics.VisibleClipBounds))
				return;
			rc.Intersect(m_bitmapGraphics.VisibleClipBounds);

			//RectangleF rect = new RectangleF(xLeft, yTop, xRight - xLeft + 1, yBottom - yTop + 1);
			//rect.Intersect(m_bitmapGraphics.VisibleClipBounds);
			//Rectangle rc = new Rectangle(
			//	m_parent.PointToScreen(new Point((int)rect.X, (int)rect.Y)),
			//	new Size((int)rect.Width, (int)rect.Height));

			//ControlPaint.FillReversibleRectangle(rc, m_backColor);


			m_backColor = Color.FromArgb(150, SystemColors.Highlight);
			m_bitmapGraphics.FillRectangle(new SolidBrush(m_backColor), rc);
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:29,代码来源:FwGraphics.cs

示例5: FillClippedRect

        /// <summary>
        /// 
        /// </summary>
        /// <param name="g"></param>
        /// <param name="brush"></param>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="width"></param>
        /// <param name="height"></param>
        public static void FillClippedRect(Graphics g, Brush brush, int x, int y, int width, int height)
        {
            RectangleF bg = new RectangleF(x, y, width, height);

            if (g.ClipBounds != null)
            {
                bg.Intersect(g.ClipBounds);
            }

            g.FillRectangle(brush, bg.X, bg.Y, bg.Width, bg.Height);
        }
开发者ID:jaropolk2,项目名称:mxgraph,代码行数:20,代码来源:mxUtils.cs

示例6: DrawLineNumber

 /// <summary>
 /// Draws a single <see cref="LineNumberItem"/>.
 /// </summary>
 /// <param name="item"></param>
 /// <param name="graphics">The <see cref="Graphics"/> to draw on.</param>
 /// <param name="brush"></param>
 /// <param name="textFormat"></param>
 /// <param name="path">The <see cref="GraphicsPath"/> to update with the drawn data.</param>
 private void DrawLineNumber(LineNumberItem item, Graphics graphics, Brush brush, StringFormat textFormat, GraphicsPath path)
 {
   var text = _lineNumbersShowAsHexadecimal
                ? item.LineNumber.ToString("X")
                : _lineNumbersShowLeadingZeroes
                    ? item.LineNumber.ToString(_lineNumbersFormat)
                    : item.LineNumber.ToString();
   var textSize = graphics.MeasureString(text, Font, new Point(0, 0), textFormat);
   var point = GetLineNumberDrawingStartPoint(item, textSize);
   // TextClipping
   var itemClipRectangle = new RectangleF(point, textSize.ToSize());
   if (_lineNumbersClipByItemRectangle)
   {
     // If selected, the text will be clipped so that it doesn't spill out of its own LineNumberItem-area.
     // Only the part of the text inside the LineNumberItem.Rectangle should be visible, so intersect with the ItemRectangle
     // The SetClip method temporary restricts the drawing area of the control for whatever is drawn next.
     itemClipRectangle.Intersect(item.Rectangle);
     graphics.SetClip(itemClipRectangle);
   }
   // TextDrawing
   graphics.DrawString(text, Font, brush, point, textFormat);
   graphics.ResetClip();
   // The GraphicsPath for the LineNumber is just a rectangle behind the text, to keep the paintingspeed high and avoid ugly artifacts.
   path.AddRectangle(itemClipRectangle);
   path.CloseFigure();
 }
开发者ID:rnpowerconsulting,项目名称:appstract,代码行数:34,代码来源:RichTextBoxLineNumbers.cs

示例7: Draw

		public void Draw(Graphics g)
		{
			RectangleF dst;
			RectangleF src;

			foreach (Tile tile in tiles)
			{
				src = new RectangleF(tile.X, tile.Y, tile.Width, tile.Height);
				src.Intersect(fov);
				
				if (src.Width.Equals(0) || src.Height.Equals(0))
					continue;

				dst = new RectangleF(p0.X + (tile.X - fov.Left) * zoom, p0.Y + (tile.Y - fov.Top) * zoom, tile.Width * zoom, tile.Height * zoom);
				dst.Intersect(p);

				src = new RectangleF(src.Left - tile.X, src.Top - tile.Y, src.Width, src.Height);

				g.DrawImage(tile.Image, dst, src, GraphicsUnit.Pixel);
			}

			if (chosen != null)
			{
				dst = new RectangleF(p0.X + (chosen.X - fov.Left) * zoom, 
					p0.Y + (chosen.Y - fov.Top) * zoom, 
					chosen.Width * zoom, chosen.Height * zoom);
				dst.Intersect(p);

				if (zoom > 0.2)
				{
					g.DrawRectangle(Pens.White, dst.Left, dst.Top, dst.Width - 1, dst.Height - 1);
					g.FillRectangle(new HatchBrush(HatchStyle.DiagonalCross, Color.White, Color.Transparent),
						dst.Left, dst.Top, dst.Width - 1, dst.Height - 1);
				}
				else
				{
					g.FillRectangle(Brushes.White, dst.Left, dst.Top, dst.Width - 1, dst.Height - 1);
				}
			}

			if (!selection.Width.Equals(r.Width) || !selection.Height.Equals(r.Height))
			{
				dst = new RectangleF(p0.X + (selection.Left - fov.Left) * zoom,
						p0.Y + (selection.Top - fov.Top) * zoom,
						selection.Width * zoom - 1, selection.Height * zoom - 1);
				dst.Intersect(p);
				g.DrawRectangle(new Pen(Brushes.Yellow, 3), dst.Left, dst.Top, dst.Width, dst.Height);
			}
		}
开发者ID:xyfgit,项目名称:salem-map-tool,代码行数:49,代码来源:Session.cs

示例8: Move

		public void Move(int x, int y)
		{ 
			if (selecting)
			{
				float xx = fov.Left + (x - p0.X) / zoom;
				float yy = fov.Top + (y - p0.Y) / zoom;

				selection = new RectangleF(xx > s0.X ? s0.X : xx, 
					yy > s0.Y ? s0.Y : yy,
					Math.Abs(xx - s0.X), Math.Abs(yy - s0.Y));

				selection = new RectangleF((float)Math.Floor(selection.Left / tileSize) * tileSize,
					(float)Math.Floor(selection.Top / tileSize) * tileSize,
					(float)(Math.Ceiling(selection.Right / tileSize) - Math.Floor(selection.Left / tileSize)) * tileSize, 
					(float)(Math.Ceiling(selection.Bottom / tileSize) - Math.Floor(selection.Top / tileSize)) * tileSize);

				selection.Intersect(r);
			}
			else 
			{
				fov = new RectangleF(
					Math.Max(0, Math.Min(fov.Left - x / zoom, r.Right - fov.Width)),
					Math.Max(0, Math.Min(fov.Top - y / zoom, r.Bottom - fov.Height)), 
					fov.Width, fov.Height);
			}
		}
开发者ID:xyfgit,项目名称:salem-map-tool,代码行数:26,代码来源:Session.cs

示例9: _DrawTimes

        private void _DrawTimes(Graphics g)
        {
            RectangleF rect = new RectangleF(0, 0, TimeGutter, Height);
            rect.Intersect(g.VisibleClipBounds);
            g.FillRectangle(_backgroundBrush, rect);

            // Times
            int startHalfHour = _GetHalfHourAt((int)g.VisibleClipBounds.Y) / 2 * 2;
            int hour = startHalfHour / 2;
            int topHour = (_TopHalfHour % 2 == 1) ? _TopHalfHour / 2 + 1 : _TopHalfHour / 2;
            string hourString;
            int midPoint = TimeGutter >> 1;
            string meridianString;

            for(int y = startHalfHour * HalfHourHeight; y < g.VisibleClipBounds.Bottom && hour < 24; y += HalfHourHeight * 2) {
                if(hour == 0) {
                    hourString = "12";
                } else if(hour > 12) {
                    hourString = (hour - 12).ToString();
                } else {
                    hourString = hour.ToString();
                }

                g.DrawLine(_timeLinePen, 5, y, TimeGutter - 5, y);
                g.DrawString(hourString, TimeLargeFont, Brushes.Black, midPoint - (int)(g.MeasureString(hourString, TimeLargeFont).Width) + 6, y + 3);

                // AM/PM
                if(hour == topHour) {
                    meridianString = topHour / 12 == 0 ? "am" : "pm";
                } else {
                    meridianString = "00";
                }

                g.DrawString(meridianString, TimeSmallFont, Brushes.Black, midPoint + 2, y + 3);
                hour++;
            }
        }
开发者ID:kjburns31,项目名称:vixen-modules,代码行数:37,代码来源:DayPanel.cs

示例10: Draw

        /// <summary>
        /// Render this object to the specified <see cref="Graphics"/> device.
        /// </summary>
        /// <remarks>
        /// This method is normally only called by the Draw method
        /// of the parent <see cref="GraphObjList"/> collection object.
        /// </remarks>
        /// <param name="g">
        /// A graphic device object to be drawn into.  This is normally e.Graphics from the
        /// PaintEventArgs argument to the Paint() method.
        /// </param>
        /// <param name="pane">
        /// A reference to the <see cref="PaneBase"/> object that is the parent or
        /// owner of this object.
        /// </param>
        /// <param name="scaleFactor">
        /// The scaling factor to be used for rendering objects.  This is calculated and
        /// passed down by the parent <see cref="GraphPane"/> object using the
        /// <see cref="PaneBase.CalcScaleFactor"/> method, and is used to proportionally adjust
        /// font sizes, etc. according to the actual size of the graph.
        /// </param>
        public override void Draw(Graphics g, PaneBase pane, float scaleFactor)
        {
            // Convert the arrow coordinates from the user coordinate system
            // to the screen coordinate system
            PointF pix1 = this.Location.TransformTopLeft(pane);
            PointF pix2 = this.Location.TransformBottomRight(pane);

            //RectangleF pixRect = this.Location.TransformRect(pane);
            RectangleF pixRect = new RectangleF(Math.Min(pix1.X, pix2.X), Math.Min(pix1.Y, pix2.Y),
                            Math.Abs(pix2.X - pix1.X), Math.Abs(pix2.Y - pix1.Y));

            //System.Diagnostics.Debug.WriteLine(string.Format("box {0} {1}", pix1, pix2));

            // Clip the rect to just outside the PaneRect so we don't end up with wild coordinates.
            RectangleF tmpRect = pane.Rect;
            tmpRect.Inflate(20, 20);
            pixRect.Intersect(tmpRect);

            if (Math.Abs(pixRect.Left) < 100000 &&
                Math.Abs(pixRect.Top) < 100000 &&
                Math.Abs(pixRect.Right) < 100000 &&
                Math.Abs(pixRect.Bottom) < 100000)
            {
                // If the box is to be filled, fill it
                _fill.Draw(g, pixRect);

                // Draw the border around the box if required
                //_border.Draw( g, pane, scaleFactor, pixRect );

                if (_border.IsVisible)
                {
                    var smode = g.SmoothingMode;
                    g.SmoothingMode = SmoothingMode.AntiAlias;

                    RectangleF tRect = pixRect;

                    float scaledInflate = (float)(_border.InflateFactor * scaleFactor);
                    tRect.Inflate(scaledInflate, scaledInflate);

                    using (Pen pen = _border.GetPen(pane, scaleFactor))
                    {
                        if (IsMoving)
                        {
                            // Set the DashCap to round.
                            pen.DashCap = DashCap.Round;

                            // Create a custom dash pattern.
                            pen.DashPattern = new float[] { 4.0F, 4.0F };
                        }

                        g.DrawRectangle(pen, tRect.X, tRect.Y, tRect.Width, tRect.Height);

                        if (IsSelected)
                        {
                            Brush brush = new SolidBrush(Color.White);

                            g.FillRectangles(brush, EdgeRects(pane));

                            pen.DashStyle = DashStyle.Solid;

                            g.DrawRectangles(pen, EdgeRects(pane));
                        }
                    }

                    g.SmoothingMode = smode;
                }
            }
        }
开发者ID:sntree,项目名称:ZedGraph,代码行数:89,代码来源:BoxObj.cs

示例11: DrawContextSubItem

        private void DrawContextSubItem(DrawListViewSubItemEventArgs e)
        {
            var match = e.Item.Tag as FindMatch;
            if (match == null) DrawSubItem(e);

            if (e.Item.Selected)
            {
                e.Graphics.FillRectangle(SystemBrushes.Highlight, e.Bounds);
            }
            else
            {
                e.Graphics.FillRectangle(SystemBrushes.Window, e.Bounds);
            }

            var lineText = match.LineText.Replace('\t', ' ');
            var spans = match.HighlightSpans;
            var pos = 0;
            var length = lineText.Length;
            var bounds = new RectangleF(e.Bounds.Left, e.Bounds.Top, e.Bounds.Width, e.Bounds.Height);
            var normalBrush = e.Item.Selected ? SystemBrushes.HighlightText : SystemBrushes.WindowText;
            var highlightBrush = Brushes.Yellow;
            var highlightTextBrush = SystemBrushes.WindowText;

            using (var sf = new StringFormat())
            {
                sf.FormatFlags = StringFormatFlags.NoWrap | StringFormatFlags.MeasureTrailingSpaces;
                sf.LineAlignment = StringAlignment.Center;

                while (pos < length && !bounds.IsEmpty)
                {
                    var nextSpan = (from s in spans where s.Start >= pos select s).FirstOrDefault();
                    if (nextSpan == null)
                    {
                        // No more highlight text to draw
                        e.Graphics.DrawString(lineText.Substring(pos), _contextFont, normalBrush, bounds, sf);
                        pos = length;
                    }
                    else
                    {
                        // Draw normal text before the highlight range
                        var drawNormal = false;
                        string normalText = "";
                        RectangleF normalBounds = new RectangleF();

                        if (nextSpan.Start > pos)
                        {
                            drawNormal = true;
                            normalText = lineText.Substring(pos, nextSpan.Start - pos);
                            normalBounds = bounds;

                            var normalSize = Util.MeasureString(e.Graphics, normalText, _contextFont, e.Bounds, sf);
                            bounds = new RectangleF(bounds.Left + normalSize.Width, bounds.Top, bounds.Width - normalSize.Width, bounds.Height);
                        }

                        // Draw highlight range
                        var text = lineText.Substring(nextSpan.Start, nextSpan.Length);

                        var highlightSize = e.Graphics.MeasureString(text, _contextFont, bounds.Location, sf);	// MeasureString() includes surrounding margins
                        var highlightRect = new RectangleF(bounds.Left, bounds.Top + (bounds.Height - highlightSize.Height) / 2, highlightSize.Width, highlightSize.Height);
                        highlightRect.Intersect(e.Bounds);
                        if (!highlightRect.IsEmpty) e.Graphics.FillRectangle(highlightBrush, highlightRect);

                        if (drawNormal)
                        {
                            e.Graphics.DrawString(normalText, _contextFont, normalBrush, normalBounds, sf);
                        }

                        e.Graphics.DrawString(text, _contextFont, highlightTextBrush, bounds, sf);
                        var size = Util.MeasureString(e.Graphics, text, _contextFont, e.Bounds, sf);
                        bounds = new RectangleF(bounds.Left + size.Width, bounds.Top, bounds.Width - size.Width, bounds.Height);

                        pos = nextSpan.Start + nextSpan.Length;
                    }
                }
            }
        }
开发者ID:cmrazek,项目名称:ProbeNpp,代码行数:76,代码来源:ResultsPanel.cs

示例12: CheckCollisions

 public void CheckCollisions(TileMap tileMap)
 {
     bool flag = base.type == ObjectType.Mouse;
     bool flag2 = false;
     bool flag3 = true;
     bool flag4 = true;
     PointF tf = new PointF();
     PointF tf2 = new PointF();
     PointF tf3 = new PointF();
     RectangleF collisionRectangle = this.GetCollisionRectangle(true);
     RectangleF ef2 = this.GetCollisionRectangle(false);
     RectangleF block = new RectangleF((PointF) new Point(0, 0), (SizeF) GameMap.TileSize);
     RectangleF ef4 = new RectangleF((PointF) new Point(0, 0), (SizeF) GameMap.TileSize);
     bool flag5 = false;
     bool flag6 = false;
     float num = 0f;
     float num2 = 0f;
     float num3 = 0f;
     float num4 = 0f;
     Rectangle tilesAroundObject = tileMap.GetTilesAroundObject(collisionRectangle);
     for (int i = tilesAroundObject.X; i < (tilesAroundObject.X + tilesAroundObject.Width); i++)
     {
         for (int j = tilesAroundObject.Y; j < (tilesAroundObject.Y + tilesAroundObject.Height); j++)
         {
             flag3 = true;
             flag4 = true;
             tf.X = collisionRectangle.X + (collisionRectangle.Width / 2f);
             tf.Y = collisionRectangle.Y + (collisionRectangle.Height / 2f);
             tf2.X = ef2.X + (ef2.Width / 2f);
             tf2.Y = ef2.Y + (ef2.Height / 2f);
             num = collisionRectangle.X - ef2.X;
             num2 = collisionRectangle.Y - ef2.Y;
             SurfaceType surfaceType = GameEngine.Game.CurrentMap.GetSurfaceType(i, j, this.aquatic);
             SurfaceType type4 = GameEngine.Game.CurrentMap.GetSurfaceType(i, j - 1, this.aquatic);
             SurfaceType type5 = GameEngine.Game.CurrentMap.GetSurfaceType(i, j + 1, this.aquatic);
             SurfaceType type2 = GameEngine.Game.CurrentMap.GetSurfaceType(i - 1, j, this.aquatic);
             SurfaceType type3 = GameEngine.Game.CurrentMap.GetSurfaceType(i + 1, j, this.aquatic);
             if (surfaceType != SurfaceType.None)
             {
                 flag6 = false;
                 num3 = 0f;
                 num4 = 0f;
                 block.X = i * block.Width;
                 block.Y = j * block.Height;
                 tf3.X = block.X + (block.Width / 2f);
                 tf3.Y = block.Y + (block.Height / 2f);
                 ef4.X = block.X;
                 ef4.Y = block.Y;
                 ef4.Width = block.Width;
                 ef4.Height = block.Height;
                 ef4.Intersect(collisionRectangle);
                 if ((ef4.Width > 0f) || (ef4.Height > 0f))
                 {
                     num3 = 0f;
                     num4 = 0f;
                     if (ef4.Height <= ef4.Width)
                     {
                         if ((num2 >= 0f) && (tf.Y < tf3.Y))
                         {
                             if (type4 == SurfaceType.None)
                             {
                                 flag2 = true;
                                 flag6 = this.ySpeed.CurrentSpeed >= 0f;
                                 if (this.CurrentAnimation == AnimType.Jump)
                                 {
                                     this.CurrentAnimation = AnimType.Stopped;
                                 }
                                 if ((surfaceType == SurfaceType.Spring) || ((tf.X > block.Left) && (tf.X <= block.Right)))
                                 {
                                     if ((surfaceType != SurfaceType.MouseBlock) || (base.objectClass == ObjectClass.Item))
                                     {
                                         flag6 = false;
                                     }
                                     this.behavior.HandleHitSurface(surfaceType, block, Direction.Up);
                                 }
                                 num4 = block.Top - collisionRectangle.Bottom;
                             }
                         }
                         else if (((num2 <= 0f) && (tf.Y > tf3.Y)) && (type5 == SurfaceType.None))
                         {
                             num4 = block.Bottom - collisionRectangle.Top;
                             flag6 = this.ySpeed.CurrentSpeed <= 0f;
                             if ((tf.X > block.Left) && (tf.X < block.Right))
                             {
                                 this.behavior.HandleHitSurface(surfaceType, block, Direction.Down);
                             }
                         }
                     }
                     if (ef4.Height >= ef4.Width)
                     {
                         if ((num >= 0f) && (tf.X < tf3.X))
                         {
                             if (type2 == SurfaceType.None)
                             {
                                 num3 = block.Left - collisionRectangle.Right;
                                 if ((tf.Y >= block.Top) && (tf.Y <= block.Bottom))
                                 {
                                     this.behavior.HandleHitSurface(surfaceType, block, Direction.Left);
                                 }
                                 flag5 = this.xSpeed.CurrentSpeed >= 0f;
//.........这里部分代码省略.........
开发者ID:maestun,项目名称:wonderboy,代码行数:101,代码来源:GameObject.cs

示例13: GetLocusIntersection

        /// <returns>Returns the loci which describes the intersection. WARNING: Where points are concerned it is assumed the point does intersect so the point simply gets returned. This is to prevent multiple calls to DoesLocusIntersect.</returns>
        public Loci GetLocusIntersection(Loci pobjTarget)
        {
            switch (this.Type)
            {
                case LociType.Line:
                    switch (pobjTarget.Type)
                    {
                        case LociType.Line:
                            PointF objReturn = PointF.Empty;
                            IntersectionHelpers.DoLinesIntersect(this.Line, pobjTarget.Line, ref objReturn);
                            return new Loci(objReturn);
                        case LociType.Point:
                            // Need to change this to return New Loci() if not intersecting.
                            return new Loci(pobjTarget.Point);
                        case LociType.Rectangle:
                            Line objReturn2 = null;
                            if (IntersectionHelpers.DoesLineIntersectRectangle(pobjTarget.Rectangle, this.Line, ref objReturn2))
                            {
                                return new Loci(objReturn2);
                            }
                            else
                            {
                                return new Loci();
                            }
                    }
                    break;
                case LociType.Point:
                    switch (pobjTarget.Type)
                    {
                        case LociType.Line:
                            return new Loci(this.Point);
                        case LociType.Point:
                            return new Loci(this.Point);
                        case LociType.Rectangle:
                            return new Loci(this.Point);
                    }
                    break;
                case LociType.Rectangle:
                    switch (pobjTarget.Type)
                    {
                        case LociType.Line:
                            Line objReturn = null;
                            if (IntersectionHelpers.DoesLineIntersectRectangle(this.Rectangle, pobjTarget.Line, ref objReturn))
                            {
                                return new Loci(objReturn);
                            }
                            else
                            {
                                return new Loci();
                            }
                        case LociType.Point:
                            return new Loci(pobjTarget.Point);
                        case LociType.Rectangle:
                            RectangleF objRectangle = new RectangleF(pobjTarget.Rectangle.Location, pobjTarget.Rectangle.Size);
                            objRectangle.Intersect(this.Rectangle);
                            return new Loci(objRectangle);
                    }
                    break;
            }

            throw new NotSupportedException();
        }
开发者ID:rlugojr,项目名称:Alferd-Spritesheet-Unpacker,代码行数:63,代码来源:Loci.cs

示例14: EdgeIntersection

		public void EdgeIntersection ()
		{
			// https://bugzilla.novell.com/show_bug.cgi?id=431587
			RectangleF one = new RectangleF(10, 10, 10, 10);
			RectangleF two = new RectangleF(20, 10, 10, 10);

			one.Intersect(two);
			Assert.IsTrue (one.IsEmpty, "Empty");
			Assert.AreEqual (20f, one.X, "X");
			Assert.AreEqual (10f, one.Y, "Y");
			Assert.AreEqual (0f, one.Width, "Width");
			Assert.AreEqual (10f, one.Height, "Height");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:13,代码来源:TestRectangleF.cs

示例15: CalculateRemainingArea

        /// <summary>
        /// Utility function. Calculates the remaining empty area of a specified area and a given content.
        /// </summary>
        /// <returns></returns>
        public static RectangleF CalculateRemainingArea(RectangleF parentArea, AnchorArea contentAnchor, RectangleF contentArea)
        {
            if (contentAnchor != null)
            {
                float left, top, height, width;

                if (contentAnchor.HasTop && !contentAnchor.HasBottom)
                {
                    top = contentArea.Bottom;
                    height = parentArea.Height - contentArea.Height;
                }
                else if (contentAnchor.HasBottom && !contentAnchor.HasTop)
                {
                    top = parentArea.Top;
                    height = parentArea.Height - contentArea.Height;
                }
                else
                {
                    top = parentArea.Top;
                    height = parentArea.Height;
                }

                if (contentAnchor.HasLeft && !contentAnchor.HasRight)
                {
                    left = contentArea.Right;
                    width = parentArea.Width - contentArea.Width;
                }
                else if (contentAnchor.HasRight && !contentAnchor.HasLeft)
                {
                    left = parentArea.Left;
                    width = parentArea.Width - contentArea.Width;
                }
                else
                {
                    left = parentArea.Left;
                    width = parentArea.Width;
                }

                RectangleF newArea = new RectangleF(left, top, width, height);
                newArea.Intersect(parentArea);

                return newArea;
            }
            else
                return parentArea;
        }
开发者ID:wsrf2009,项目名称:KnxUiEditor,代码行数:50,代码来源:ContainerBase.cs


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