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


C# PointF.Equals方法代码示例

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


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

示例1: Line2DBase

 public Line2DBase(PointF p1, PointF p2, Pen pen)
 {
     this.Pen = pen;
     if (!p1.Equals(p2))
     {
         Point1 = p1;
         Point2 = p2;
     }
     else
     {
         throw new System.ArithmeticException("Points are equals");
     }
 }
开发者ID:dadelcarbo,项目名称:StockAnalyzer,代码行数:13,代码来源:Line2DBase.cs

示例2: TryPoint

 internal bool TryPoint(PointF TrialPoint, SizeF Rectangle)
 {
     if (TrialPoint.Equals(_SpiralEndSentinel)) return true;
         var TrailRectangle = new RectangleF(TrialPoint, Rectangle);
         return !_Occupied.Any(x => x.IntersectsWith(TrailRectangle));
 }
开发者ID:chandru9279,项目名称:Disorganizer,代码行数:6,代码来源:TagCloudService.cs

示例3: pb_Paint


//.........这里部分代码省略.........
                        pts[i] = new PointF(x, y);
                    }
                    #region cube to quad
                    if (ltype == (int)LineTypes.Quadratic || ltype == (int)LineTypes.SmoothQuadratic)
                    {
                        for (int i = 0; i < line.Length; i++)
                        {
                            int PT = getPtype(i);
                            if (PT == 0)
                            {
                                Qpts[i] = pts[i];
                            }
                            else if (PT == 1)
                            {
                                Qpts[i] = new PointF(pts[i].X * 2f / 3f + pts[i - 1].X * 1f / 3f,
                                    pts[i].Y * 2f / 3f + pts[i - 1].Y * 1f / 3f);
                            }
                            else if (PT == 2)
                            {
                                Qpts[i] = new PointF(pts[i - 1].X * 2f / 3f + pts[i + 1].X * 1f / 3f,
                                    pts[i - 1].Y * 2f / 3f + pts[i + 1].Y * 1f / 3f);
                            }

                            else if (PT == 3)
                            {
                                Qpts[i] = pts[i];
                            }
                        }

                    }
                    #endregion

                    bool islinked = true;
                    if (pts.Length > 0 && !Oldxy.Equals(pts[0]))
                    {
                        loopBack = new PointF(pts[0].X, pts[0].Y);
                        islinked = false;
                    }

                    //render lines
                    e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;

                    if ((Control.ModifierKeys & Keys.Control) != Keys.Control)
                    {
                        #region draw handles
                        if ((j == -1 || j == LineList.SelectedIndex) && line.Length >= 1) //buffer draw
                        {

                            if ((ctype || mpmode) && pts.Length > 1)
                            {
                                e.Graphics.DrawRectangle(new Pen(AnchorColor), loopBack.X - 4, loopBack.Y - 4, 6, 6);
                            }
                            else if (islinked)
                            {
                                PointF[] tri = {new PointF(pts[0].X, pts[0].Y - 4f),
                                                new PointF(pts[0].X + 3f, pts[0].Y + 3f),
                                                new PointF(pts[0].X - 4f, pts[0].Y + 3f)};
                                e.Graphics.DrawPolygon(new Pen(AnchorColor), tri);
                            }
                            else
                            {

                                e.Graphics.DrawEllipse(new Pen(AnchorColor), pts[0].X - 4, pts[0].Y - 4, 6, 6);
                            }

                            for (int i = 1; i < pts.Length; i++)
开发者ID:TheDwarfHorde,项目名称:DHShapeMaker,代码行数:67,代码来源:EffectPluginConfigDialog.cs

示例4: MakePath

        private void MakePath()
        {
            int ltype = 0;
            bool ctype = false;
            bool mpmode = false;
            bool islarge = false;
            bool revsweep = false;
            PointF loopBack = new PointF(-9999, -9999);
            PointF Oldxy = new PointF(-9999, -9999);

            Array.Resize(ref PGP, Lines.Count);

            for (int j = 0; j < Lines.Count; j++)
            {
                PointF[] line;
                try
                {
                    PGP[j] = new GraphicsPath();
                }
                catch (Exception e) { MessageBox.Show(e.Message); }

                line = (Lines[j] as PData).Lines;
                ltype = (Lines[j] as PData).LineType;
                ctype = (Lines[j] as PData).ClosedType;
                mpmode = (Lines[j] as PData).LoopBack;
                islarge = (Lines[j] as PData).IsLarge;
                revsweep = (Lines[j] as PData).RevSweep;

                PointF[] pts = new PointF[line.Length];
                PointF[] Qpts = new PointF[line.Length];
                for (int i = 0; i < line.Length; i++)
                {
                    float x = (float)OutputScale.Value * (float)SuperSize.Width / 100f * line[i].X;
                    float y = (float)OutputScale.Value * (float)SuperSize.Height / 100f * line[i].Y;
                    pts[i] = new PointF(x, y);
                }
                #region cube to quad
                if (ltype == (int)LineTypes.Quadratic || ltype == (int)LineTypes.SmoothQuadratic)
                {
                    for (int i = 0; i < line.Length; i++)
                    {
                        int PT = getPtype(i);
                        if (PT == 0)
                        {
                            Qpts[i] = pts[i];
                        }
                        else if (PT == 1)
                        {
                            Qpts[i] = new PointF(pts[i].X * 2f / 3f + pts[i - 1].X * 1f / 3f,
                                pts[i].Y * 2f / 3f + pts[i - 1].Y * 1f / 3f);
                        }
                        else if (PT == 2)
                        {
                            Qpts[i] = new PointF(pts[i - 1].X * 2f / 3f + pts[i + 1].X * 1f / 3f,
                                pts[i - 1].Y * 2f / 3f + pts[i + 1].Y * 1f / 3f);
                        }

                        else if (PT == 3)
                        {
                            Qpts[i] = pts[i];
                        }
                    }

                }
                #endregion

                if (pts.Length > 0 && !Oldxy.Equals(pts[0]))
                {
                    loopBack = new PointF(pts[0].X, pts[0].Y);
                }
                //render lines

                #region drawlines

                if (line.Length > 3 && (ltype == (int)LineTypes.Quadratic || ltype == (int)LineTypes.SmoothQuadratic))
                {
                    try
                    {
                        PGP[j].AddBeziers(Qpts);
                    }
                    catch { }
                }
                else if (line.Length > 3 && (ltype == (int)LineTypes.Cubic || ltype == (int)LineTypes.SmoothCubic))
                {
                    try
                    {
                        PGP[j].AddBeziers(pts);
                    }
                    catch { }
                }
                else if (line.Length > 1 && ltype == (int)LineTypes.Straight)
                {

                    PGP[j].AddLines(pts);

                }
                else if (line.Length == 5 && ltype == (int)LineTypes.Ellipse)
                {
                    PointF mid = pointAverage(pts[0], pts[4]);

//.........这里部分代码省略.........
开发者ID:TheDwarfHorde,项目名称:DHShapeMaker,代码行数:101,代码来源:EffectPluginConfigDialog.cs

示例5: PreDrawLineOrArc

		private bool PreDrawLineOrArc(object param, DrawType drawtype, PointF from, PointF to)
		{
			PaintEventArgs e = (PaintEventArgs)param;

			if (from.Equals(to))
			{
				if (drawtype == DrawType.LaserCut)
					e.Graphics.DrawEllipse(GetPen(drawtype, LineDrawType.Dot), from.X, from.Y, 1, 1);
				else
					e.Graphics.DrawEllipse(GetPen(drawtype, LineDrawType.Dot), from.X, from.Y, 4, 4);

				return false;
			}
			return true;
		}
开发者ID:aiten,项目名称:CNCLib,代码行数:15,代码来源:GCodeBitmapDraw.cs

示例6: RefinePoints

		//Removes points that are line with each other
		protected internal void RefinePoints()
		{
			if (Points.Count < 3) return;

			PointF lastPoint = new PointF();
			int index = 0;
			int loop = 0;

			//Loop through and see if there is an index to remove
			//Use the loop variable to make sure havent entered endless loop
			while (index < Points.Count && loop < Points.Count)
			{
				index = 0;
				loop += 1;
				foreach (PointF point in Points)
				{
					if (index > 0)
					{
						//Check if x co-ordinates are within the grain but not equal
						if (Math.Abs(point.X - lastPoint.X) < 1 && point.X != lastPoint.X)
						{
							if (lastPoint.Equals(Points[0]))
							{
								Points[index] = new PointF(lastPoint.X,point.Y);
							}
							else
							{
								Points[index-1] = new PointF(point.X,LastPoint.Y);
							}
							break;
						}
						//Check y coordinates are not equal but within the grain
						else if (Math.Abs(point.Y - lastPoint.Y) < 1 && point.Y != lastPoint.Y)
						{
							if (lastPoint.Equals(Points[0]))
							{
								Points[index] = new PointF(point.X,lastPoint.Y);
							}
							else
							{
								Points[index-1] = new PointF(lastPoint.X,point.Y);
							}
							break;
						}
					}
					lastPoint = (PointF) Points[index];
					index+=1;
				}
			}
			
			PointF secondLast = new PointF();
			PointF refPoint = new PointF();
			int remove = 0;

			while (remove != -1)
			{
				remove = -1;
				
				//Loop through and see if there is an index to remove
				foreach (PointF point in Points)
				{
					if (!lastPoint.IsEmpty)
					{
						if (!secondLast.IsEmpty)
						{
							//Check if x coordinates are in line
							if (secondLast.X == lastPoint.X && lastPoint.X == point.X)
							{	
								remove = Points.IndexOf(lastPoint);
								break;
							}
							//Check if y coordinates are in line
							if (secondLast.Y == lastPoint.Y && lastPoint.Y == point.Y)
							{	
								remove = Points.IndexOf(lastPoint);
								break;
							}
						}
						secondLast = lastPoint;
					}
					lastPoint = point;
				}

				//Remove point if required
				if (remove != -1) Points.RemoveAt(remove);
			}
		}
开发者ID:savagemat,项目名称:arcgis-diagrammer,代码行数:88,代码来源:Connector.cs

示例7: ContainsInSegment

		/// <summary>
		/// Checks whether the given point lies on the line segment.
		/// </summary>
		public bool ContainsInSegment(PointF point)
		{
			if (point.Equals(_a) || point.Equals(_b))
				return true;

			if (!Bounds.Contains(point))
				return false;

			if (_a.X == _b.X) return point.X == _a.X;
			if (_a.Y == _b.Y) return point.Y == _a.Y;

			return (point.X - _a.X) * (_b.Y - _a.Y) ==
				(point.Y - _a.Y) * (_b.X - _a.X);
		}
开发者ID:ChrisMoreton,项目名称:Test3,代码行数:17,代码来源:Geometry.cs

示例8: setPoint2

        private void setPoint2(PointF p = new PointF())
        {
            if (tabControl1.SelectedTab.Equals(tabCalibrate))
                {
                    if (!p.Equals(calibratePoint1.Point))
                        calibratePoint2.Point = p;
                    else
                        MessageBox.Show("Points can not be it the same location!");

                    if (!calibratePoint1.IsEmpty() && !calibratePoint2.IsEmpty()) // setPoint for calibration
                    {
                        distanceBetweenCalibratePoints = GetDistanceBetween(calibratePoint1.Point, calibratePoint2.Point);

                        CalculateScale();
                    }
                }
                else if (tabControl1.SelectedTab.Equals(tabAnalyze) && level == 3) // setPoint for analyze
                {
                    if (!p.Equals(images.getActual().point1.Point))
                    {
                        if (!images.getActual().point1.IsEmpty())
                        {

                            double distance = GetDistanceBetween(images.getActual().point1.Point, p);
                            double ratio = distanceBetweenCalibratePoints / distance;
                            double vectorX = ((p.X - images.getActual().point1.Point.X) * ratio) * (Double.Parse(tb_real_length.Text, CultureInfo.InvariantCulture) / 100) * (Double.Parse(tb_ideal_legth.Text, CultureInfo.InvariantCulture) / Double.Parse(tb_scale.Text, CultureInfo.InvariantCulture));
                            double vectorY = ((p.Y - images.getActual().point1.Point.Y) * ratio) * (Double.Parse(tb_real_length.Text, CultureInfo.InvariantCulture) / 100) * (Double.Parse(tb_ideal_legth.Text, CultureInfo.InvariantCulture) / Double.Parse(tb_scale.Text, CultureInfo.InvariantCulture));
                            images.getActual().setPoint2(new PointF((float)(images.getActual().point1.Point.X + vectorX), (float)(images.getActual().point1.Point.Y + vectorY)));

                            UpdateObjectFixedPoints();
                            UpdateInfo();
                        }
                        else
                            images.getActual().setPoint2(p);

                    }
                    else
                        MessageBox.Show("Points can not be it the same location!");
                }

                imageBox.Invalidate();
        }
开发者ID:rissstep,项目名称:IFGPro,代码行数:42,代码来源:MainWindow.cs

示例9: GetSolution

		//Creates the solution from the calculated nodes as vectors
		public ArrayList GetSolution()
		{
			///Add an additional node to the end if the solution didnt match the goal
			if (mSolution.Equals(mGoal) || mSolution.Parent == null)
			{
				mGoal = mSolution;
			}
			else
			{
				//If in line then add the goal as a node to the solution, else move the solution node
				if (mSolution.X == mGoal.X || mSolution.Y == mGoal.Y)
				{
					mGoal.Parent = mSolution;
				}
				else
				{
					RouteNode extra = new RouteNode();
					extra.Parent = mSolution; 

					//Set node coordinates
					extra.X = (mSolution.X == mSolution.Parent.X) ? mSolution.X : mGoal.X;
					extra.Y = (mSolution.Y == mSolution.Parent.Y) ? mSolution.Y : mGoal.Y;
					
					//Link the goal to the new node and add it
					mGoal.Parent = extra;
				}
			}

			ArrayList list = new ArrayList();
			
			RouteNode previous = mGoal;
			RouteNode node = mGoal.Parent;
			
			list.Add(new PointF(previous.X, previous.Y));

			//Only one or two items
			if (node == null || node.Parent == null) return list;

			while (node.Parent != null)
			{
				if (!((previous.X == node.Parent.X) || (previous.Y == node.Parent.Y)))
				{
					list.Insert(0, new PointF(node.X, node.Y));
					previous = node;
				}
				node = node.Parent;
			}

			//Add the start node
			PointF start = new PointF(node.X, node.Y);
			if (!start.Equals((PointF) list[0])) list.Insert(0, start);
			
			return list;
		}
开发者ID:savagemat,项目名称:arcgis-diagrammer,代码行数:55,代码来源:Route.cs

示例10: ManageMouseMoveDrawing

        protected void ManageMouseMoveDrawing(System.Windows.Forms.MouseEventArgs e, PointF mouseValuePoint)
        {
            switch (this.DrawingMode)
            {
                case GraphDrawMode.AddSAR:
                    if (this.DrawingStep == GraphDrawingStep.SelectItem)
                    {
                        // first point is already selected, draw new line
                        if (!selectedValuePoint.Equals(mouseValuePoint))
                        {
                            DrawTmpSAR(this.foregroundGraphic, mouseValuePoint);
                        }
                    }
                    break;
                case GraphDrawMode.AddLine:
                    if (this.DrawingStep == GraphDrawingStep.ItemSelected)
                    {
                        // first point is already selected, draw new line
                        if (!selectedValuePoint.Equals(mouseValuePoint))
                        {
                            DrawTmpItem(this.foregroundGraphic, this.DrawingPen, new Line2D(selectedValuePoint, mouseValuePoint), true, true);
                        }
                    }
                    break;
                case GraphDrawMode.AddSegment:
                    if (this.DrawingStep == GraphDrawingStep.ItemSelected)
                    {
                        // first point is already selected, draw new line
                        if (!selectedValuePoint.Equals(mouseValuePoint))
                        {
                            DrawTmpSegment(this.foregroundGraphic, this.DrawingPen, selectedValuePoint, mouseValuePoint, true, true);
                        }
                    }
                    break;
                case GraphDrawMode.AddHalfLine:
                    if (this.DrawingStep == GraphDrawingStep.ItemSelected)
                    {
                        // first point is already selected, draw new line
                        if (!selectedValuePoint.Equals(mouseValuePoint))
                        {
                            DrawTmpHalfLine(this.foregroundGraphic, this.DrawingPen, selectedValuePoint, mouseValuePoint, true, true);
                        }
                    }
                    break;
                case GraphDrawMode.FanLine:
                    if (this.DrawingStep == GraphDrawingStep.ItemSelected)
                    {
                        // first point is already selected, draw new line
                        if (!selectedValuePoint.Equals(mouseValuePoint))
                        {
                            DrawTmpItem(this.foregroundGraphic, this.DrawingPen, new Line2D(selectedValuePoint, mouseValuePoint), true, true);
                        }
                    }
                    break;
                case GraphDrawMode.AndrewPitchFork:
                    switch (this.DrawingStep)
                    {
                        case GraphDrawingStep.SelectItem: // Selecting the second point
                            if (andrewPitchFork != null && !andrewPitchFork.Point1.Equals(mouseValuePoint))
                            {
                                DrawTmpSegment(this.foregroundGraphic, this.DrawingPen, andrewPitchFork.Point1, mouseValuePoint, true, true);
                            }
                            break;
                        case GraphDrawingStep.ItemSelected: // Selecting third point

                            if (mouseValuePoint.Equals(andrewPitchFork.Point1) || mouseValuePoint.Equals(andrewPitchFork.Point2))
                            {
                                break;
                            }
                            andrewPitchFork.Point3 = mouseValuePoint;
                            try
                            {
                                foreach (Line2DBase newLine in andrewPitchFork.GetLines(this.DrawingPen))
                                {
                                    DrawTmpItem(this.foregroundGraphic, this.DrawingPen, newLine, true, true);
                                }
                            }
                            catch (System.ArithmeticException)
                            {
                            }
                            break;
                        default:   // Shouldn't come there
                            break;
                    }
                    break;
                case GraphDrawMode.CopyLine:
                    switch (this.DrawingStep)
                    {
                        case GraphDrawingStep.SelectItem: // Select the line to copy
                            HighlightClosestLine(e);
                            break;
                        case GraphDrawingStep.ItemSelected: // Create new // line
                            if (selectedLineIndex != -1)
                            {
                                Line2D paraLine = ((Line2DBase)this.drawingItems[selectedLineIndex]).GetParallelLine(mouseValuePoint);
                                this.DrawTmpItem(this.foregroundGraphic, this.DrawingPen, paraLine, true, true);
                            }
                            break;
                        default:   // Shouldn't come there
                            break;
//.........这里部分代码省略.........
开发者ID:dadelcarbo,项目名称:StockAnalyzer,代码行数:101,代码来源:GraphCloseControl.cs

示例11: allowModify

		internal override bool allowModify(PointF current)
		{
			if (!snapToNodeBorder)
				current = flowChart.AlignPointToGrid(current);

			if (modifyHandle == 0 && current.Equals(points[points.Count-1]))
				return false;
			if (modifyHandle == points.Count-1 && current.Equals(points[0]))
				return false;
			if (modifyHandle == 0 || modifyHandle == points.Count-1)
			{
				Node node = flowChart.GetNodeAt(current);
				objNewDest = node;

				if (node == null)
					return flowChart.AllowUnconnectedArrows && flowChart.confirmModify(this);

				if (node.notInteractive())
					return false;
				if (!node.canHaveArrows(modifyHandle == 0))
					return false;

				bool changingOrg = modifyHandle == 0;
				if (!flowChart.requestAttach(this, changingOrg, node))
					return false;

				// check for reflexive links
				if (!flowChart.AllowRefLinks)
				{
					if (modifyHandle == 0 && node == destLink.getNode())
						return false;
					if (modifyHandle == points.Count-1 && node == orgnLink.getNode())
						return false;
				}

				// check for repeated links
				bool linkedObjChanges =	node !=
					(changingOrg ? orgnLink.getNode() : destLink.getNode());
				if (!flowChart.AllowLinksRepeat && linkedObjChanges)
				{
					if (modifyHandle == 0 && node.alreadyLinked(destLink.getNode()))
						return false;
					if (modifyHandle == points.Count-1 &&
						orgnLink.getNode().alreadyLinked(node))
						return false;
				}

				flowChart.setAutoAnchors(node);
			}
			else 
				if (style == ArrowStyle.Cascading &&
				(modifyHandle == 1 || modifyHandle == points.Count - 2))
			{
				int h = modifyHandle;
				PointF ptp = points[h-1];
				PointF ptn = points[h+1];
				if ((cascadeStartHorizontal && h%2 > 0) || (!cascadeStartHorizontal && h%2 == 0))
				{
					ptp.Y = points[h].Y;
					ptn.X = points[h].X;
				}
				else
				{
					ptp.X = points[h].X;
					ptn.Y = points[h].Y;
				}
				if (modifyHandle == 1 && !ptp.Equals(points[0]))
					if (!orgnLink.canMoveLink(ptp))
						return false;
				if (modifyHandle == points.Count - 2 && !ptn.Equals(points[points.Count-1]))
					if (!destLink.canMoveLink(ptn))
						return false;
			}

			RectangleF rc = getBoundingRect();
			if (flowChart.rectRestrict(ref rc))
				return false;

			return flowChart.confirmModify(this);
		}
开发者ID:ChrisMoreton,项目名称:Test3,代码行数:80,代码来源:Arrow.cs

示例12: tmrWaypoint_Tick

 private void tmrWaypoint_Tick(object sender, EventArgs e)
 {
     PointF position = new PointF(LocalPlayer.XPos, LocalPlayer.YPos);
     if (!position.Equals(OldPosition))
     {
         OldPosition = position;
         waypoints.Add(position);
     }
 }
开发者ID:johnmoore,项目名称:WoW-Radar,代码行数:9,代码来源:frmMain.cs

示例13: GetNextPointInEdge

        /*
         * This method gives points that crawls along an edge of the spiral, described below.
         */

        internal PointF GetNextPointInEdge(PointF current)
        {
            do
            {
                if (current.Equals(CurrentCorner))
                {
                    CurrentCorner = GetSpiralNext(CurrentCorner);
                    if (CurrentCorner.Equals(spiralEndSentinel)) return spiralEndSentinel;
                }
                current = current.X == CurrentCorner.X
                              ? new PointF(current.X, edgeDirection(current.Y))
                              : new PointF(edgeDirection(current.X), current.Y);
            } while (!mainArea.Contains(current));
            return current;
        }
开发者ID:chandru9279,项目名称:zasz.me,代码行数:19,代码来源:TagCloudService.cs

示例14: TryPoint

 internal bool TryPoint(PointF trialPoint, SizeF rectangle)
 {
     if (trialPoint.Equals(spiralEndSentinel)) return true;
     var trailRectangle = new RectangleF(trialPoint, rectangle);
     return !Occupied.Any(x => x.IntersectsWith(trailRectangle));
 }
开发者ID:chandru9279,项目名称:zasz.me,代码行数:6,代码来源:TagCloudService.cs

示例15: GetNextPointInEdge

 /*
      * This method gives points that crawls along an edge of the spiral, described below.
      */
 internal PointF GetNextPointInEdge(PointF Current)
 {
     do
         {
             if (Current.Equals(_CurrentCorner))
             {
                 _CurrentCorner = GetSpiralNext(_CurrentCorner);
                 if (_CurrentCorner.Equals(_SpiralEndSentinel)) return _SpiralEndSentinel;
             }
             Current = Current.X == _CurrentCorner.X
                           ? new PointF(Current.X, _EdgeDirection(Current.Y))
                           : new PointF(_EdgeDirection(Current.X), Current.Y);
         } while (!_MainArea.Contains(Current));
         return Current;
 }
开发者ID:chandru9279,项目名称:Disorganizer,代码行数:18,代码来源:TagCloudService.cs


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