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


C# Point.Equals方法代码示例

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


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

示例1: Contains

		/// <summary>
		/// 目标点是否在线段上 (y2-y1)(x-x1) = (y-y1)(x2-x1)
		/// </summary>		
		public bool Contains(Point pt)
		{
			if((pt.Equals(this.pt1)) ||(pt.Equals(this.pt2)))
			{
				return true ;
			}

			float left  = (this.pt2.Y - this.pt1.Y) * (pt.X       - this.pt1.X) ;
			float right = (pt.Y       - this.pt1.Y) * (this.pt2.X - this.pt1.X) ;

			if(Math.Abs(left - right) < GeometryHelper.ToleranceForFloat)
			{
				return false ;
			}

			if(! GeometryHelper.IsInRegion(pt.X ,this.pt1.X ,this.pt2.X))
			{
				return false ;
			}

			if(! GeometryHelper.IsInRegion(pt.Y ,this.pt1.Y ,this.pt2.Y))
			{
				return false ;
			}

			return true ;
		}
开发者ID:maanshancss,项目名称:ClassLibrary,代码行数:30,代码来源:LineSegment.cs

示例2: CheckIfSegmentIntersectInteriorSegment

 public static bool CheckIfSegmentIntersectInteriorSegment(Segment s)
 {
     foreach (var seg in SegmentsManager.InteriorSegments)
     {
         if (!s.A.X.Equals(seg.A.X) && !s.A.X.Equals(seg.B.X) && !s.B.X.Equals(seg.A.X) && !s.B.X.Equals(seg.B.X))
         {
             VerificaIntersectia = new Intersectie(seg.A, seg.B, s.A, s.B);
             if (VerificaIntersectia.Intersectation())
             {
                 var pt = new Point(Convert.ToInt32(VerificaIntersectia.x), Convert.ToInt32(VerificaIntersectia.y));
                 if (!(pt.Equals(s.A) || pt.Equals(s.B)))
                     return true;
             }
         }
     }
     return false;
 }
开发者ID:am1guma,项目名称:BR,代码行数:17,代码来源:IntersectieManager.cs

示例3: huir

        public void huir(MouseEventArgs e,Point puntoAntiguoRaton,int heightForm,int widthForm)
        {
            int pixlMovimiento = 0;//Cantidad de pixeles que se va a mover por cada movimiento del ratón.
            Point nuevoPunto = new Point(posicion.X, posicion.Y);

            if (Math.Abs(posicion.X - e.X) < Math.Abs(posicion.X - puntoAntiguoRaton.X) ||
                Math.Abs(posicion.Y - e.Y) < Math.Abs(posicion.Y - puntoAntiguoRaton.Y)) /*se comprueba que el ratón se haya acercado a la persona*/
            {

                if (!puntoAntiguoRaton.Equals(e.Location))/*se comprueba que el ratón se haya movido*/
                {
                    /* dependiendo de la distancia,se cambia lo que se mueve*/
                    if (distancia(posicion, e.Location) > vista)
                    {
                        pixlMovimiento = 0;
                    }
                    if (distancia(posicion, e.Location) < vista)
                    {
                        pixlMovimiento = velocidadAndar;
                    }
                    if (distancia(posicion, e.Location) < vista/2)
                    {
                        pixlMovimiento = velocidadCorrer;
                    }

                    /* Se comprueba la posición del ratón con respecto al botón para que se mueva huyendo de él*/
                    if (posicion.X > e.Location.X)
                    {
                        nuevoPunto.X = nuevoPunto.X + pixlMovimiento;

                    }
                    else
                    {
                        nuevoPunto.X = nuevoPunto.X - pixlMovimiento;
                    }
                    if (posicion.Y > e.Location.Y)
                    {
                        nuevoPunto.Y = nuevoPunto.Y + pixlMovimiento;

                    }
                    else
                    {
                        nuevoPunto.Y = nuevoPunto.Y - 1;
                    }
                    if (nuevoPunto.X > 10 && nuevoPunto.Y > 10 && nuevoPunto.Y < heightForm - 10 - tamanio && nuevoPunto.X < widthForm - 10 - tamanio)
                    {
                        posicion = nuevoPunto;
                        boton.Location = posicion;
                    }

                }

            }
        }
开发者ID:tempestaddepvc,项目名称:ID,代码行数:54,代码来源:Persona.cs

示例4: OnDragOver

        /// <summary>
        /// On dragging, we updates the cursor and displays an insertion marker.
        /// </summary>
        /// <param name="e"></param>
        protected override void OnDragOver(DragEventArgs e)
        {
            base.OnDragOver(e);
            var draggedTab = GetDraggedTab(e);

            // Retrieve the point in client coordinates
            Point pt = new Point(e.X, e.Y);
            pt = PointToClient(pt);
            if (pt.Equals(m_lastPoint)) return;
            m_lastPoint = pt;

            // Make sure there is a TabPage being dragged.
            if (draggedTab == null)
            {
                e.Effect = DragDropEffects.None;
                return;
            }

            // Retrieve the dragged page. If same as dragged page, return
            var hoveredTab = GetTabPageAt(pt);
            if (draggedTab == hoveredTab)
            {
                e.Effect = DragDropEffects.None;
                m_markerIndex = -1;
                return;
            }

            // Get the old and new marker indices
            bool onLeft;
            int newIndex = GetMarkerIndex(draggedTab, pt, out onLeft);
            var oldIndex = m_markerIndex;
            m_markerIndex = newIndex;
            m_markerOnLeft = onLeft;

            // Updates the new tab index
            if (oldIndex != newIndex)
            {
                UpdateMarker();
            }

            e.Effect = DragDropEffects.Move;
        }
开发者ID:wow4all,项目名称:evemu_server,代码行数:46,代码来源:DraggableTabControl.cs

示例5: LeftMouseUp

 public void LeftMouseUp(ref EditorData data, Point gridPosition)
 {
     if(gridPosition.Equals(_mInitial))
     {
         if(!data.CtrlHeld) data.SelectedEntities.Clear();
         var selected = data.Level.SelectEntity(gridPosition);
         if (selected != null && !data.SelectedEntities.Contains(selected))
             data.SelectedEntities.Add(selected);
         else if (selected == null && !data.CtrlHeld)
             data.SelectedEntities.Clear();
     }
     if (data.SelectedEntities.Count > 0)
     {
         data.Level.MoveEntity(data.SelectedEntities,
             new Size(Point.Subtract(_mInitial, new Size(gridPosition))), false);
         data.Level.MoveEntity(data.SelectedEntities,
             new Size(Point.Subtract(gridPosition, new Size(_mInitial))), true);
     }
     _mouseDown = false;
 }
开发者ID:DizWARE,项目名称:Mr-Gravity,代码行数:20,代码来源:SingleSelect.cs

示例6: Test

        public static bool Test()
        {
            bool ok = true;
            string s = string.Empty;

            // DecodePoint
            Point p1 = new Point(5, 104);
            s = DecodePointInverse(p1);
            Point p2 = DecodePoint(s);

            if (!p1.Equals(p2))
                ok = false;

            // DecodeSize
            Size s1 = new Size(1254, 67);
            s = DecodeSizeInverse(s1);
            Size s2 = DecodeSize(s);

            if (!s1.Equals(s2))
                ok = false;

            // DecodeFont
            Font f1 = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Bold | FontStyle.Italic, GraphicsUnit.Point);
            s = DecodeFontInverse(f1);
            Font f2 = DecodeFont(s);

            if (!f1.Equals(f2))
                ok = false;

            // DecodeDateTime
            DateTime t1 = DateTime.Today;
            s = DecodeDateTimeInverse(t1);
            DateTime t2 = DecodeDateTime(s);

            if (!t1.Equals(t2))
                ok = false;

            // DecodeAppearance
            Appearance a1 = Appearance.Button;
            s = DecodeAppearanceInverse(a1);
            Appearance a2 = DecodeAppearance(s);

            if (!t1.Equals(t2))
                ok = false;

            // DecodeScrollBars
            ScrollBars sb1 = ScrollBars.Both;
            s = DecodeScrollBarsInverse(sb1);
            ScrollBars sb2 = DecodeScrollBars(s);

            if (!sb1.Equals(sb2))
                ok = false;

            // DecodeSelectionMode
            SelectionMode sm1 = SelectionMode.MultiSimple;
            s = DecodeSelectionModeInverse(sm1);
            SelectionMode sm2 = DecodeSelectionMode(s);

            if (!sm1.Equals(sm2))
                ok = false;

            // DecodeView
            View v1 = View.LargeIcon;
            s = DecodeViewInverse(v1);
            View v2 = DecodeView(s);

            if (!v1.Equals(v2))
                ok = false;

            // DecodeOrientation
            Orientation o1 = Orientation.Vertical;
            s = DecodeOrientationInverse(o1);
            Orientation o2 = DecodeOrientation(s);

            if (!o1.Equals(o2))
                ok = false;

            // DecodeTickStyle
            TickStyle ts1 = TickStyle.BottomRight;
            s = DecodeTickStyleInverse(ts1);
            TickStyle ts2 = DecodeTickStyle(s);

            if (!ts1.Equals(ts2))
                ok = false;

            // DecodeTabAlignment
            TabAlignment ta1 = TabAlignment.Right;
            s = DecodeTabAlignmentInverse(ta1);
            TabAlignment ta2 = DecodeTabAlignment(s);

            if (!ta1.Equals(ta2))
                ok = false;

            // DecodeListViewItem (single)
            ListViewItem lv1 = new ListViewItem("John Doe");
            s = DecodeListViewItemInverse(lv1);
            ListViewItem lv2 = DecodeListViewItem(s);

            /* not comparable (only by reference)
            if (!lv1.Equals(lv2))
//.........这里部分代码省略.........
开发者ID:jozilla,项目名称:Uiml.net,代码行数:101,代码来源:SWFTypeDecoders.cs

示例7: MoveExact

            private void MoveExact(int x, int y)
            {
                float effectiveX = x / (POWER * 1f),
                      effectiveY = y / (POWER * 1f);

                var actualX = (int)Math.Floor((float)(x + (POWER / 2)) / POWER);
                var actualY = (int)Math.Floor((float)(y + (POWER / 2)) / POWER);
                var targets = GetHitTargets();
                var sourceLeft = effectiveX * _map.TileSize;
                var sourceTop = effectiveY * _map.TileSize;
                var sourceRect = new RectangleF(sourceLeft, sourceTop, _map.TileSize, _map.TileSize);
                var collisions = new List<Point>();
                var possible = new List<Point>();

                foreach (var t in targets)
                {
                    int targetX = actualX + t.X,
                        targetY = actualY + t.Y;

                    var targetRect = new RectangleF(targetX * _map.TileSize, targetY * _map.TileSize, _map.TileSize, _map.TileSize);
                    var movable = Movable(targetX, targetY);
                    var intersects = sourceRect.IntersectsWith(targetRect);

                    if (!movable && intersects)
                    {
                        collisions.Add(new Point(targetX, targetY));
                    }
                    else
                    {
                        possible.Add(new Point(targetX, targetY));
                    }
                }

                if (collisions.Count == 0)
                {
                    SetDirection(DirectionX, DirectionY);

                    X = actualX;
                    Y = actualY;

                    ExactX = x;
                    ExactY = y;
                }
                else
                {
                    var candidates = new List<Tuple<int, int, Point>>();
                    Tuple<int, int, Point> candidate = null;
                    var p1 = new Point(actualX + DirectionX, actualY);
                    var p2 = new Point(actualX, actualY + DirectionY);
                    foreach (var nextMove in possible)
                    {
                        if (p1.Equals(nextMove))
                        {
                            candidates.Add(Tuple.Create(DirectionX, 0, p1));
                        }

                        if (p2.Equals(nextMove))
                        {
                            candidates.Add(Tuple.Create(0, DirectionY, p2));
                        }
                    }

                    if (candidates.Count == 1)
                    {
                        candidate = candidates[0];
                    }
                    else if (candidates.Count == 2)
                    {
                        int minDistance = Int32.MaxValue;
                        for (int i = 0; i < candidates.Count; ++i)
                        {
                            var targetCandidate = candidates[i];
                            int xs = (ExactX - candidates[i].Item3.X * POWER);
                            int ys = (ExactY - candidates[i].Item3.Y * POWER);
                            int distance = xs * xs + ys * ys;

                            if (distance < minDistance)
                            {
                                minDistance = distance;
                                candidate = targetCandidate;
                            }
                        }
                    }

                    if (candidate != null)
                    {
                        var diffX = candidate.Item3.X * POWER - ExactX;
                        var diffY = candidate.Item3.Y * POWER - ExactY;
                        var absX = Math.Abs(diffX);
                        var absY = Math.Abs(diffY);
                        int effectiveDirectionX = 0;
                        int effectiveDirectionY = 0;

                        if (absX == 100)
                        {
                            effectiveDirectionX = 0;
                        }
                        else
                        {
                            effectiveDirectionX = Math.Sign(diffX);
//.........这里部分代码省略.........
开发者ID:NTaylorMullen,项目名称:BombRMan,代码行数:101,代码来源:GameServer.cs

示例8: TestMinMax2

      public void TestMinMax2()
      {
         Matrix<Single> matrix = new Matrix<Single> (10, 10);
         matrix.SetValue (5);
         matrix [5, 5] = 10;
         matrix [3, 3] = 0;

         double minVal = 5;
         double maxVal = 5;
         Point minLoc = new Point();
         Point maxLoc = new Point();

         matrix.MinMax (out minVal, out maxVal, out minLoc, out maxLoc);
         EmguAssert.IsTrue(minVal == 0);
         EmguAssert.IsTrue(maxVal == 10);
         EmguAssert.IsTrue(minLoc.Equals(new Point(3, 3)));
         EmguAssert.IsTrue(maxLoc.Equals(new Point(5, 5)));
      }
开发者ID:neutmute,项目名称:emgucv,代码行数:18,代码来源:AutoTestMatrix.cs

示例9: ProcessObstacles

        private void ProcessObstacles()
        {
            ModelGame mg = (ModelGame)model;

            // We moeten een 2e array maken om door heen te loopen
            // Er is kans dat we de array door lopen en ook tegelijkertijd een explosie toevoegen
            // We voegen dan als het ware iets toe en lezen tegelijk, dit mag niet
            List<GameObject> safeListArray = new List<GameObject>(mg.GameObjects);

            SlowingObstacle slowedDownObstacle = null;

            // Loop door alle obstacles objecten en roep methode aan
            foreach (GameObject gameObject in safeListArray)
            {
                if (gameObject is MovingExplodingObstacle)
                {
                    MovingExplodingObstacle gameObstacle = (MovingExplodingObstacle)gameObject;

                    //Opslaan van huidige locatie in variable om vervolgens te vergelijken
                    Point currentLocation = new Point(gameObstacle.Location.X, gameObstacle.Location.Y);

                    gameObstacle.ChasePlayer(mg.player, "x");

                    gameObstacle.ProcessCollision(safeListArray, "x");

                    gameObstacle.ChasePlayer(mg.player, "y");
                    gameObstacle.ProcessCollision(safeListArray, "y");

                    if (gameObstacle.IsSmart && currentLocation.Equals(gameObstacle.Location) && !gameObstacle.SmartMovingEnabled)
                    {
                        gameObstacle.SmartmovingTime = DateTime.Now.AddMilliseconds(2500);
                        gameObstacle.SmartMovingEnabled = true;
                    }

                    if (gameObstacle.IsSmart && gameObstacle.SmartMovingEnabled)
                    {
                        //Controleert als het object nog steeds slim moet zijn
                        if (gameObstacle.SmartmovingTime >= DateTime.Now)
                        {
                            //Probeert weg te komen van stilstaant object
                            gameObstacle.TryToEscape();
                        }
                        else
                        {
                            gameObstacle.SmartMovingEnabled = false;
                            gameObstacle.SmartmovingDirection = ""; // Reset direction voor smart movement
                            gameObstacle.DirectionTime = default(DateTime);
                        }
                    }

                    if (gameObstacle.CollidesWith(mg.player))
                    {
                        score = 0;
                        mg.player.Location = new Point(0, 0);
                        UpdatePlayerPosition();
                        mg.InitializeField();
                        mg.GameObjects.Add(new Explosion(gameObstacle.Location, 10, 10));
                        mg.player.ObjectImage = Resources.Player;
                }

                }

                if (gameObject is SlowingObstacle)
                {
                    SlowingObstacle gameObstacle = (SlowingObstacle)gameObject;

                    //Opslaan van huidige locatie in variable om vervolgens te vergelijken
                    Point currentLocation = gameObstacle.Location;

                    gameObstacle.ChasePlayer(mg.player, "x");
                    gameObstacle.ProcessCollision(safeListArray, "x");

                    gameObstacle.ChasePlayer(mg.player, "y");
                    gameObstacle.ProcessCollision(safeListArray, "y");

                    if (gameObstacle.IsSmart && currentLocation.Equals(gameObstacle.Location) && !gameObstacle.SmartMovingEnabled)
                    {
                        gameObstacle.SmartmovingTime = DateTime.Now.AddMilliseconds(2500);
                        gameObstacle.SmartMovingEnabled = true;
                    }

                    if (gameObstacle.IsSmart && gameObstacle.SmartMovingEnabled)
                    {
                        //Controleert als het object nog steeds slim moet zijn
                        if (gameObstacle.SmartmovingTime >= DateTime.Now)
                        {
                            //Probeert weg te komen van stilstaant object
                            gameObstacle.TryToEscape();
                        }
                        else
                        {
                            gameObstacle.SmartMovingEnabled = false;
                            gameObstacle.SmartmovingDirection = ""; // Reset direction voor smart movement
                            gameObstacle.DirectionTime = default(DateTime);
                        }
                    }

                    if (mg.player.CollidesWith(gameObstacle))
                    {
                        slowedDownObstacle = gameObstacle;
//.........这里部分代码省略.........
开发者ID:sliscers,项目名称:Windesheim-Warriors,代码行数:101,代码来源:Controllers.cs

示例10: wavefront

        private void wavefront(Point start, Point goal, int val)
        {
            if (start.x < 0 || start.x > 7 || start.y < 0 || start.y > 3)
            {
                return;
            }
            int cell = getCell(start);

            if (cell < 0 || (cell > 0 && cell < val))
            {
                return;
            }

            setCell(start, val);
            //Console.Out.WriteLine("x: " + start.x + " y: " + start.y + " val: " + getCell(start));
            if (start.Equals(goal))
            {
                return;
            }
            wavefront(new Point(start.x - 1, start.y), goal, val + 1);
            wavefront(new Point(start.x + 1, start.y), goal, val + 1);
            wavefront(new Point(start.x, start.y - 1), goal, val + 1);
            wavefront(new Point(start.x, start.y + 1), goal, val + 1);
            wavefront(new Point(start.x - 1, start.y-1), goal, val + 1);
            wavefront(new Point(start.x + 1, start.y-1), goal, val + 1);
            wavefront(new Point(start.x-1, start.y - 1), goal, val + 1);
            wavefront(new Point(start.x+1, start.y + 1), goal, val + 1);
        }
开发者ID:antipax,项目名称:awesomebot,代码行数:28,代码来源:Form1.cs

示例11: check_food

        private void check_food()
        {
            int food_num = 0;
            Point tmp = new Point();
            if (food_status == 1)
            {
                for (int i = 0; i < row - 1; i++)
                {
                    for (int j = 0; j < col - 1; j++)
                    {
                        if (all[i, j] == 2)
                        {
                            food_num++;
                            tmp.X = i;
                            tmp.Y = j;
                        }
                    }
                }
                if (food_num != 1)
                {
                    //MessageBox.Show("food to much , error");
                }
                if (!tmp.Equals(food_cur))
                {
                    //MessageBox.Show("food not to match , error");
                }
                return;
            }

            //MessageBox.Show("no food  , error");
        }
开发者ID:c-ber,项目名称:cber,代码行数:31,代码来源:Form1.cs

示例12: SearchRunPoints

        /// <summary>
        /// Calculates the distances to the enemy of every point around the target and returns the points ordered in a list.
        /// </summary>
        /// <param name="player"></param>
        /// <param name="playerTeam"></param>
        /// <param name="targetPoint"></param>
        /// <param name="range">The range around the target point</param>
        /// <param name="amountOfPlayers">The amount of players which are allowed to stand around the calculated point </param>
        /// <param name="rangeRectangle"></param>
        /// <returns></returns>
        public List<Point> SearchRunPoints(Player player, Team playerTeam, Point targetPoint, int range, int amountOfPlayers, Rectangle rangeRectangle)
        {
            Pathfinding pathfinding = new Pathfinding();

            Point rootPoint = targetPoint;
            List<Point> neighbors = new List<Point>();
            List<double> distancesToTarget = new List<double>();

            double rootDistanceToTarget = Pathfinding.DistanceBetweenPoints(player.Location, targetPoint);

            Point? bestNeighbor = null;
            int bestSurroundingEnemies = -1;

            for (int v = -2; v <= 2; v++)
            {
                for (int h = -2; h <= 2; h++)
                {
                    Point neighbor = new Point(rootPoint.X + h, rootPoint.Y + v);
                    int surroundingEnemies = SurroundingPlayers(GetEnemyTeam(playerTeam), range, neighbor, 1).Count;
                    double tmpDistanceToTarget = Pathfinding.DistanceBetweenPoints(neighbor, targetPoint);
                    if (pathfinding.IsWithinField(neighbor) && !neighbor.Equals(player.Location) && (!Pathfinding.CurrentBlockedRoom.Room.Contains(neighbor) || Pathfinding.CurrentBlockedRoom.AllowedTeam.Equals(playerTeam)))
                    {
                        if (tmpDistanceToTarget < rootDistanceToTarget && (bestSurroundingEnemies == -1 || surroundingEnemies < bestSurroundingEnemies))
                        {
                            bestNeighbor = neighbor;
                            bestSurroundingEnemies = surroundingEnemies;
                        }
                        if (rangeRectangle.Contains(neighbor) && pathfinding.StandsPlayerOnPosition(neighbor, 1) == null && surroundingEnemies <= amountOfPlayers)
                        {

                            if (neighbors.Count == 0)
                            {
                                neighbors.Add(neighbor);
                                distancesToTarget.Add(tmpDistanceToTarget);
                            }
                            else
                            {
                                for (int i = 0; i <= distancesToTarget.Count; i++)
                                {
                                    if (i == distancesToTarget.Count || tmpDistanceToTarget < distancesToTarget[i])
                                    {
                                        neighbors.Insert(i, neighbor);
                                        distancesToTarget.Insert(i, tmpDistanceToTarget);
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
            }

            if (neighbors.Count == 0)
            {
                if (bestNeighbor.HasValue)
                {
                    neighbors.Add(bestNeighbor.Value);
                }
                else
                {
                    neighbors.Add(targetPoint);
                }

            }
            return neighbors;
        }
开发者ID:Jecral,项目名称:Football,代码行数:76,代码来源:AI.cs

示例13: AnimateFrame

		private void AnimateFrame(Rectangle box, Graphics g, ref int marqueeX) {
			if (box == null || g == null || box.Width <= 1) { return; }

			Pen penb = new Pen(new SolidBrush(blend));
			g.FillRectangle(new SolidBrush(color1), box);
			for (int i = box.Right + marqueeX; i > box.Left; i -= ((box.Height * 2) + StripeSpacing - 1)) {
				Point theoreticalRightTop = new Point(i, box.Top);
				Point theoreticalRightBottom = new Point(i - box.Height, box.Bottom);
				Point theoreticalLeftTop = new Point(i - box.Height, box.Top);
				Point theoreticalLeftBottom = new Point(i - (box.Height * 2), box.Bottom);

				Point leftTop, leftBottom, rightTop, rightBottom;
				using (GraphicsPath gp = new GraphicsPath()) {
					if (theoreticalLeftTop.X <= box.Left) {
						// left triangle
						int diff = i - box.Height;
						rightTop = new Point(i, box.Top);
						rightBottom = new Point(box.Left, box.Bottom + diff);
						leftTop = new Point(box.Left, box.Top);
						leftBottom = leftTop;

						if (rightBottom.Equals(rightTop)) { continue; }

						gp.AddLine(rightTop, rightBottom);
						gp.AddLine(rightBottom, leftTop);
						gp.AddLine(leftTop, new Point(i, box.Top));
					} else if (theoreticalLeftBottom.X <= box.Left) {
						// left pentagon
						int diff = i - (box.Height * 2);
						rightTop = new Point(i, box.Top);
						rightBottom = new Point(i - box.Height, box.Bottom);
						leftTop = new Point(i - box.Height, box.Top);
						leftBottom = new Point(box.Left, box.Bottom + diff);

						gp.AddLine(rightTop, rightBottom);
						gp.AddLine(rightBottom, new Point(box.Left, box.Bottom));
						gp.AddLine(new Point(box.Left, box.Bottom), leftBottom);
						gp.AddLine(leftBottom, leftTop);
						gp.AddLine(leftTop, rightTop);
					} else if (theoreticalRightBottom.X >= box.Right) {
						// right triangle
						int diff = marqueeX - box.Height;
						leftTop = new Point(box.Right, box.Top + diff); //= something funky
						leftBottom = theoreticalLeftBottom;
						rightBottom = new Point(box.Right, box.Bottom);
						rightTop = rightBottom;

						if (leftBottom.Equals(leftTop)) { continue; }

						gp.AddLine(leftTop, rightBottom);
						gp.AddLine(rightBottom, leftBottom);
						gp.AddLine(leftBottom, leftTop);
					} else if (theoreticalRightTop.X >= box.Right) {
						// right pentagon
						int diff = i - box.Right;
						Point topRight = new Point(box.Right, box.Top);
						rightTop = new Point(box.Right, box.Top + diff);
						rightBottom = new Point(i - box.Height, box.Bottom);
						leftTop = new Point(i - box.Height, box.Top);
						leftBottom = new Point(i - (box.Height * 2), box.Bottom);

						gp.AddLine(leftTop, topRight);
						gp.AddLine(topRight, rightTop);
						gp.AddLine(rightTop, rightBottom);
						gp.AddLine(rightBottom, leftBottom);
						gp.AddLine(leftBottom, leftTop);
					} else {
						// mid-range rectangle
						rightTop = new Point(i, box.Top);
						rightBottom = new Point(i - box.Height, box.Bottom);
						leftTop = new Point(i - box.Height, box.Top);
						leftBottom = new Point(i - (box.Height * 2), box.Bottom);

						gp.AddLine(rightTop, rightBottom);
						gp.AddLine(rightBottom, leftBottom);
						gp.AddLine(leftBottom, leftTop);
						gp.AddLine(leftTop, rightTop);
					}
					g.FillPath(new SolidBrush(color2), gp);
				}

				if (!leftTop.Equals(leftBottom)) {
					g.DrawLine(penb, leftTop, leftBottom);
				}
				if (!rightTop.Equals(rightBottom)) {
					g.DrawLine(penb, rightTop, rightBottom);
				}
			}
			g.DrawLine(penb, new Point(box.Left, box.Bottom), new Point(box.Right, box.Bottom));

			if (++marqueeX > (box.Height * 2) + StripeSpacing) {
				marqueeX = 1;
			}
		}
开发者ID:androidhacker,项目名称:DotNetProjs,代码行数:94,代码来源:StripedProgressPainter.cs

示例14: dif_height

        //On dif height
        private void dif_height(Point inp, Point outp, int ot)
        {
            Point a = new Point(outp.X, inp.Y);
            Point b = new Point(inp.X - ot, inp.Y);
            if (!testX(a, b) || !testY(outp,a))
            {
                Point b0 = b;
                Point a0 = new Point(outp.X, outp.Y - ot);
                Point a1 = a0;

                //And here
                    for (int i = 0; i < field_matrix.GetLength(0); i++)
                    {
                        if (testX(a, b)) break;
                        a.Y +=(int)Math.Pow(-1, i) * (i + 1) * sc;
                        b.Y +=(int)Math.Pow(-1, i) * (i + 1) * sc;

                    }

                    for (int i = 0; i < field_matrix.GetLength(0); i++)
                    {
                        if (testY(a0, a)) break;
                        a0.X += (int)Math.Pow(-1, i) * (i + 1) * sc;
                        a.X += (int)Math.Pow(-1, i) * (i + 1) * sc;

                    }

                    for (int i = 0; i < field_matrix.GetLength(0); i++)
                    {
                        if (testY(b0, b)) break;
                        b0.X += (int)Math.Pow(-1, i) * (i + 1) * sc;
                        b.X += (int)Math.Pow(-1, i) * (i + 1) * sc;

                    }

                  if (!points.ContainsKey(outp)) points.Add(outp, a1);
                  if (!points.ContainsKey(a1) && !a1.Equals(a)) points.Add(a1, a0);
                  if (!points.ContainsKey(a0) && !a0.Equals(a)) points.Add(a0, a);
                  if (!points.ContainsKey(a)) points.Add(a, b);
                  if (!points.ContainsKey(b)) points.Add(b, b0);
                  if (!points.ContainsKey(b0) && !b0.Equals(b)) points.Add(b0, inp);

            }
            else
            {
                points.Add(outp, a);
                points.Add(a, inp);
            }

            int ar = 5;
            if (inp.X < outp.X) ar = -ar;
            points.Add(new Point(inp.X - ar, inp.Y - ar), inp);
            points.Add(new Point(inp.X - ar, inp.Y + ar), inp);
        }
开发者ID:natalie-chetverikova,项目名称:PetriNet,代码行数:55,代码来源:Lines.cs

示例15: one_height

        //On one height
        private void one_height(Point  inp, Point  outp, int ot)
        {
            Point a = new Point(outp.X + ot, outp.Y);
            Point b = new Point(inp.X - ot, inp.Y);
            if (!testX(a, b))
            {
                Point a0 = new Point(outp.X + ot, outp.Y);
                Point b0 = new Point(inp.X - ot, inp.Y);
            //Сюда тот цикл со сменой знака
                for (int i = 0; i < field_matrix.GetLength(0); i++)
                {
                    if (testX(a, b)) break;
                    a.Y += (int)Math.Pow(-1, i) * (i + 1) * sc;
                    b.Y += (int)Math.Pow(-1, i) * (i + 1) * sc;

                }

                for (int i = 0; i < field_matrix.GetLength(0); i++)
                {
                    if (testY(a0, a)) break;
                    a0.X += (int)Math.Pow(-1, i) * (i + 1) * sc;
                    a.X += (int)Math.Pow(-1, i) * (i + 1) * sc;

                }

                for (int i = 0; i < field_matrix.GetLength(0); i++)
                {
                    if (testY(b0, b)) break;
                    b0.X += (int)Math.Pow(-1, i) * (i + 1) * sc;
                    b.X += (int)Math.Pow(-1, i) * (i + 1) * sc;

                }
                if (!points.ContainsKey(outp)) points.Add(outp, a0);
                if (!points.ContainsKey(a0) && !a0.Equals(a)) points.Add(a0, a);
                if (!points.ContainsKey(a)) points.Add(a, b);
                if (!points.ContainsKey(b)) points.Add(b, b0);
                if (!points.ContainsKey(b0) && !b0.Equals(b)) points.Add(b0, inp);

            }
            else
            {
                if (!points.ContainsKey(outp)) points.Add(outp, inp);
            }

            int ar = 5;
            points.Add(new Point(inp.X - ar, inp.Y - ar), inp);
            points.Add(new Point(inp.X - ar, inp.Y + ar), inp);
        }
开发者ID:natalie-chetverikova,项目名称:PetriNet,代码行数:49,代码来源:Lines.cs


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