• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Point类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Move

        public void Move(Point newLocation)
        {
            if (newLocation == null)
                throw new ArgumentNullException(nameof(newLocation), "The new location is null!");

            Move(newLocation.X, newLocation.Y);
        }
开发者ID:AlexJCarstensen,项目名称:ProgrammingWithMosh,代码行数:7,代码来源:Point.cs


示例17: GetCursorPosition

 public static Point GetCursorPosition()
 {
     Point currentMousePoint;
     var gotPoint = GetCursorPos(out currentMousePoint);
     if (!gotPoint) { currentMousePoint = new Point(0, 0); }
     return currentMousePoint;
 }
开发者ID:JustoSenka,项目名称:MouseRobot,代码行数:7,代码来源:WinAPI.cs


示例18: OnMouseDown

 protected override void OnMouseDown(MouseEventArgs e)
 {
     _startPoint = e.Location;
     _hscrolloffset = LayoutTarget.HorizontalScroll.Value;
     _vscrolloffset = LayoutTarget.VerticalScroll.Value;
     base.OnMouseDown(e);
 }
开发者ID:WesleyYep,项目名称:ispyconnect,代码行数:7,代码来源:ViewControllerPanel.cs


示例19: Render

        //private Bitmap img = new Bitmap(Resources.GetBytes(Resources.BinaryResources.AnalogTicksOutside),
        //                                        Bitmap.BitmapImageType.Gif);
        //private Bitmap img = new Bitmap(Resources.GetBytes(Resources.BinaryResources.AnalogTicksInside),
        //                                        Bitmap.BitmapImageType.Gif);


        public override void Render(Bitmap screen)
        {
            if (_screen == null) _screen = screen;

            screen.DrawImage(0, 0, img, 0, 0, img.Width, img.Height);

            var text = "AGENT";
            Point textLocation = new Point(
                AGENT.Center.X - (drawing.MeasureString(text, smallFont) / 2), AGENT.Center.Y - 25);
            screen.DrawText(text, smallFont, Color.White, textLocation.X, textLocation.Y);

            var date = Settings.Now.ToString(CultureInfo.CurrentUICulture.DateTimeFormat.MonthDayPattern);
            ; //time.MonthNameShort + " " + time.Day;

            Point dateLocation = new Point(
                AGENT.Center.X - (drawing.MeasureString(date, smallFont) / 2), AGENT.Center.Y + 20);
            screen.DrawText(date, smallFont, Color.White, dateLocation.X, dateLocation.Y);

            //draw our hands
            drawing.PaintSkinnyHands(screen, Settings.Now, AGENT.Center);


            
            drawing.DrawTray(screen, _notificationProvider, smallFont);

        }
开发者ID:nicksi,项目名称:AGENT.Contrib,代码行数:32,代码来源:AnalogFace.cs


示例20: RespawnInfo

        public RespawnInfo(BinaryReader reader, int Version, int Customversion)
        {
            MonsterIndex = reader.ReadInt32();

            Location = new Point(reader.ReadInt32(), reader.ReadInt32());

            Count = reader.ReadUInt16();
            Spread = reader.ReadUInt16();

            Delay = reader.ReadUInt16();
            Direction = reader.ReadByte();

            if (Envir.LoadVersion >= 36)
            {
                RoutePath = reader.ReadString();
            }

            if (Version > 67)
            {
                RandomDelay = reader.ReadUInt16();
                RespawnIndex = reader.ReadInt32();
                SaveRespawnTime = reader.ReadBoolean();
                RespawnTicks = reader.ReadUInt16();
            }
            else
            {
                RespawnIndex = ++SMain.Envir.RespawnIndex;
            }
        }
开发者ID:Pete107,项目名称:Mir2,代码行数:29,代码来源:RespawnInfo.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Point2类代码示例发布时间:2022-05-24
下一篇:
C# Pocket类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap