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


C# Point类代码示例

本文整理汇总了C#中Point的典型用法代码示例。如果您正苦于以下问题:C# Point类的具体用法?C# Point怎么用?C# Point使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: AddPoint

 public Point AddPoint(float value, DateTime timestamp)
 {
     var p = new Point(value, timestamp);
     _points.Add(p);
     _lastPoint = p;
     return p;
 }
开发者ID:jasondentler,项目名称:YouTrackBurnDown,代码行数:7,代码来源:Line.cs

示例2: TranslatePoint

		public static Point TranslatePoint(Point point1, Point point2, Point point3, double angle)
		{
			var angle1 = Math.Atan2(point1.Y - point2.Y, point1.X - point2.X);
			var angle2 = angle1 - angle / AngleConvert;
			var length = (point3 - point2).Length;
			return new Point(point2.X + length * Math.Cos(angle2), point2.Y + length * Math.Sin(angle2));
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:7,代码来源:GeometryHelper.cs

示例3: RotateImage

        /// <summary>
        /// Rotate an image on a point with a specified angle
        /// </summary>
		/// <param name="pe">The paint area event where the image will be displayed</param>
		/// <param name="img">The image to display</param>
		/// <param name="alpha">The angle of rotation in radian</param>
		/// <param name="ptImg">The location of the left upper corner of the image to display in the paint area in nominal situation</param>
		/// <param name="ptRot">The location of the rotation point in the paint area</param>
		/// <param name="scaleFactor">Multiplication factor on the display image</param>
        protected void RotateImage(PaintEventArgs pe, Image img, Double alpha, Point ptImg, Point ptRot, float scaleFactor)
        {
            double beta = 0; 	// Angle between the Horizontal line and the line (Left upper corner - Rotation point)
            double d = 0;		// Distance between Left upper corner and Rotation point)		
            float deltaX = 0;	// X componant of the corrected translation
            float deltaY = 0;	// Y componant of the corrected translation

			// Compute the correction translation coeff
            if (ptImg != ptRot)
            {
				//
                if (ptRot.X != 0)
                {
                    beta = Math.Atan((double)ptRot.Y / (double)ptRot.X);
                }

                d = Math.Sqrt((ptRot.X * ptRot.X) + (ptRot.Y * ptRot.Y));

                // Computed offset
                deltaX = (float)(d * (Math.Cos(alpha - beta) - Math.Cos(alpha) * Math.Cos(alpha + beta) - Math.Sin(alpha) * Math.Sin(alpha + beta)));
                deltaY = (float)(d * (Math.Sin(beta - alpha) + Math.Sin(alpha) * Math.Cos(alpha + beta) - Math.Cos(alpha) * Math.Sin(alpha + beta)));
            }

            // Rotate image support
            pe.Graphics.RotateTransform((float)(alpha * 180 / Math.PI));

            // Dispay image
            pe.Graphics.DrawImage(img, (ptImg.X + deltaX) * scaleFactor, (ptImg.Y + deltaY) * scaleFactor, img.Width * scaleFactor, img.Height * scaleFactor);

            // Put image support as found
            pe.Graphics.RotateTransform((float)(-alpha * 180 / Math.PI));

        }
开发者ID:suas-anadolu,项目名称:groundstation,代码行数:42,代码来源:InstrumentControl.cs

示例4: Distance

 /// <summary>
 /// Compute the distance between the two point values
 /// </summary>
 /// <param name="source">The source point</param>
 /// <param name="target">The target point</param>
 /// <returns>the distance between the two provided points</returns>
 public static double Distance(this Point source, Point target)
 {
     return Math.Sqrt(
         (source.X - target.X) * (source.X - target.X) +
         (source.Y - target.Y) * (source.Y - target.Y)
         );
 }
开发者ID:senfo,项目名称:snaglV2,代码行数:13,代码来源:PointUtils.cs

示例5: Execute

        public override void Execute(TextArea textArea)
        {
            Point position = textArea.Caret.Position;
            List<FoldMarker> foldings = textArea.Document.FoldingManager.GetFoldedFoldingsWithEnd(position.Y);
            FoldMarker justBeforeCaret = null;
            foreach (FoldMarker fm in foldings) {
                if (fm.EndColumn == position.X) {
                    justBeforeCaret = fm;
                    break; // the first folding found is the folding with the smallest Startposition
                }
            }

            if (justBeforeCaret != null) {
                position.Y = justBeforeCaret.StartLine;
                position.X = justBeforeCaret.StartColumn;
            } else {
                if (position.X > 0) {
                    --position.X;
                } else if (position.Y  > 0) {
                    LineSegment lineAbove = textArea.Document.GetLineSegment(position.Y - 1);
                    position = new Point(lineAbove.Length, position.Y - 1);
                }
            }

            textArea.Caret.Position = position;
            textArea.SetDesiredColumn();
        }
开发者ID:jumpinjackie,项目名称:fdotoolbox,代码行数:27,代码来源:CaretActions.cs

示例6: SetLocation

		protected virtual void SetLocation()
		{
			TextArea textArea = control.ActiveTextAreaControl.TextArea;
			TextLocation caretPos  = textArea.Caret.Position;
			
			int xpos = textArea.TextView.GetDrawingXPos(caretPos.Y, caretPos.X);
			int rulerHeight = textArea.TextEditorProperties.ShowHorizontalRuler ? textArea.TextView.FontHeight : 0;
			Point pos = new Point(textArea.TextView.DrawingPosition.X + xpos,
			                      textArea.TextView.DrawingPosition.Y + (textArea.Document.GetVisibleLine(caretPos.Y)) * textArea.TextView.FontHeight
			                      - textArea.TextView.TextArea.VirtualTop.Y + textArea.TextView.FontHeight + rulerHeight);
			
			Point location = control.ActiveTextAreaControl.PointToScreen(pos);
			
			// set bounds
			Rectangle bounds = new Rectangle(location, drawingSize);
			
			if (!workingScreen.Contains(bounds)) {
				if (bounds.Right > workingScreen.Right) {
					bounds.X = workingScreen.Right - bounds.Width;
				}
				if (bounds.Left < workingScreen.Left) {
					bounds.X = workingScreen.Left;
				}
				if (bounds.Top < workingScreen.Top) {
					bounds.Y = workingScreen.Top;
				}
				if (bounds.Bottom > workingScreen.Bottom) {
					bounds.Y = bounds.Y - bounds.Height - control.ActiveTextAreaControl.TextArea.TextView.FontHeight;
					if (bounds.Bottom > workingScreen.Bottom) {
						bounds.Y = workingScreen.Bottom - bounds.Height;
					}
				}
			}
			Bounds = bounds;
		}
开发者ID:XQuantumForceX,项目名称:Reflexil,代码行数:35,代码来源:AbstractCompletionWindow.cs

示例7: Draw

 public override void Draw(SpriteBatchUI spriteBatch, Point position)
 {
     Vector3 hueVector = Utility.GetHueVector(Hue);
     int width = (int)(m_PercentWidthDrawn * Width);
     spriteBatch.Draw2D(m_Texture, new Rectangle(position.X, position.Y, width, Height), new Rectangle(0, 0, width, Height), hueVector);
     base.Draw(spriteBatch, position);
 }
开发者ID:msx752,项目名称:UltimaXNA,代码行数:7,代码来源:GumpPicWithWidth.cs

示例8: Item

 protected Item(Image image, Image imageEffect, Sound soundEffect, Point initialPosition)
     : base(image, Rectangle.FromCenter(initialPosition, Size.Zero))
 {
     this.imageEffect = imageEffect;
     this.soundEffect = soundEffect;
     RenderLayer = MaxRenderLayer;
 }
开发者ID:hillwhite,项目名称:DeltaEngine,代码行数:7,代码来源:Item.cs

示例9: mouseZone_MouseMove

        void mouseZone_MouseMove(object sender, MouseEventArgs e)
        {
            if (IsActive)
            {
                _viewport.Cursor = Cursors.None;

                var centerOfViewport = _viewport.PointToScreen(new Point(_viewport.ActualWidth / 2, _viewport.ActualHeight / 2));
                var relativePos = e.MouseDevice.GetPosition(_viewport);
                var actualRelativePos = new Point(relativePos.X - _viewport.ActualWidth / 2, _viewport.ActualHeight / 2 - relativePos.Y);
                var dx = actualRelativePos.X;
                var dy = actualRelativePos.Y;
                _yaw += dx;
                _pitch += dy;
                
                // Rotate
                Rotation = QuaternionHelper.EulerAnglesInDegToQuaternion(_pitch * Sensitivity * 0.1, _yaw * Sensitivity * 0.1, 0);
                
                // Set mouse position back to the center of the viewport in screen coordinates
                MouseUtilities.SetPosition(centerOfViewport);
            }
            else
            {
                _viewport.Cursor = Cursors.Arrow;
            }
        }
开发者ID:Inner-room,项目名称:VrPlayer,代码行数:25,代码来源:MouseTracker.cs

示例10: Rectangle

 // -----------------------
 // Public Constructors
 // -----------------------
 /// <summary>
 ///	Rectangle Constructor
 /// </summary>
 ///
 /// <remarks>
 ///	Creates a Rectangle from Point and Size values.
 /// </remarks>
 public Rectangle(Point location, Size size)
 {
     x = location.X;
     y = location.Y;
     width = size.Width;
     height = size.Height;
 }
开发者ID:yudhitech,项目名称:xamarin-android,代码行数:17,代码来源:Rectangle.cs

示例11: InflAffixTemplateEventArgs

		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="context"/>
		/// <param name="location"/>
		public InflAffixTemplateEventArgs(Control context, XmlNode node, Point location, int tag)
		{
			m_location = location;
			m_node = node;
			m_contextControl = context;
			m_tag = tag;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:12,代码来源:InflAffixTemplateEventArgs.cs

示例12: Particle_SmokeStream

 public Particle_SmokeStream(Vector2 position)
 {
     this.position = position;
     size = new Point(10, 10);
     color = Color.White;
     texture = Texture2DLibrary.particle_smoke;
 }
开发者ID:Hoobler,项目名称:Projekt1,代码行数:7,代码来源:Particle_SmokeStream.cs

示例13: GetColumnDividerAt

        internal TreeColumn GetColumnDividerAt(Point p)
        {
            if (p.Y > ColumnHeaderHeight)
                return null;

            int x = -OffsetX;
            TreeColumn prevCol = null;
            Rectangle left, right;
            foreach (TreeColumn col in Columns)
            {
                if (col.IsVisible)
                {
                    if (col.Width > 0)
                    {
                        left = new Rectangle(x, 0, DividerWidth / 2, ColumnHeaderHeight);
                        right = new Rectangle(x + col.Width - (DividerWidth / 2), 0, DividerWidth / 2, ColumnHeaderHeight);
                        if (left.Contains(p) && prevCol != null)
                            return prevCol;
                        else if (right.Contains(p))
                            return col;
                    }
                    prevCol = col;
                    x += col.Width;
                }
            }

            left = new Rectangle(x, 0, DividerWidth / 2, ColumnHeaderHeight);
            if (left.Contains(p) && prevCol != null)
                return prevCol;

            return null;
        }
开发者ID:redoz,项目名称:bitdiffer,代码行数:32,代码来源:TreeViewAdv.Input.cs

示例14: AddString

 public void AddString(string s,	FontFamily family,	int style, float emSize, Point origin, StringFormat format)
 {
     var font = new Font (family.Name, emSize, (FontStyle)style);
     var layoutRect = RectangleF.Empty;
     layoutRect.Location = origin;
     NativeDrawString (s, font, Color.Red, layoutRect, format);
 }
开发者ID:asfungithub,项目名称:sysdrawing-coregraphics,代码行数:7,代码来源:GraphicsPath-AddString.cs

示例15: ScaleTo

 public static Point ScaleTo( Point value, Point source, Point dest )
 {
     return new Point(
         ScaleTo( value.X, source.X, dest.X ),
         ScaleTo( value.Y, source.Y, dest.Y )
         );
 }
开发者ID:NaturalSoftwareJP,项目名称:NaturalSoftware.Kinect.CSharp,代码行数:7,代码来源:KinectUtility.cs


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