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

C# Windows.Point类代码示例

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

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



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

示例1: ContainsPoint

 /// <summary>
 /// Returns a value indicating whether a point is inside the bounding box of the element.
 /// </summary>
 /// <param name="element"></param>
 /// <param name="pointRelativeToElement"></param>
 /// <returns></returns>
 public static bool ContainsPoint(this FrameworkElement element, Point pointRelativeToElement)
 {
     //TODO: Silverlight allows more complex geometries than Rectangle.
     Rect rect = new Rect { X = 0, Y = 0, Width = element.ActualWidth, Height=element.ActualHeight };
     
     return rect.Contains(pointRelativeToElement);            
 }
开发者ID:nhannd,项目名称:Xian,代码行数:13,代码来源:UIElementExtensions.cs


示例2: Setup

        public void Setup()
        {
            m_StartSegment = Substitute.For <ITurnCircleArcSegment>();
            m_MiddleSegment = Substitute.For <ITurnCircleArcSegment>();
            m_EndSegment = Substitute.For <ITurnCircleArcSegment>();

            m_Path = Substitute.For <IPath>();
            var segments = new List <IPolylineSegment>
                           {
                               m_StartSegment,
                               m_MiddleSegment,
                               m_EndSegment
                           };

            m_Path.Segments.Returns(segments);

            m_ArcSegmentOne = new ArcSegment(new Point(10.0,
                                                       10.0),
                                             new Size(10.0,
                                                      10.0),
                                             45.0,
                                             false,
                                             SweepDirection.Clockwise,
                                             false);

            m_LineSegment = new LineSegment(new Point(20.0,
                                                      20.0),
                                            false);

            m_ArcSegmentTwo = new ArcSegment(new Point(30.0,
                                                       30.0),
                                             new Size(30.0,
                                                      30.0),
                                             90.0,
                                             false,
                                             SweepDirection.Counterclockwise,
                                             false);

            m_ArcSegmentThree = new ArcSegment(new Point(40.0,
                                                         40.0),
                                               new Size(40.0,
                                                        40.0),
                                               135.0,
                                               false,
                                               SweepDirection.Counterclockwise,
                                               false);


            m_Point = new Point(10.0,
                                10.0);

            m_Helper = Substitute.For <IPathSegmentHelper>();
            m_Helper.SegmentToLineSegment(Line.Unknown).ReturnsForAnyArgs(m_LineSegment);
            m_Helper.SegmentToArcSegment(TurnCircleArcSegment.Unknown).ReturnsForAnyArgs(m_ArcSegmentOne,
                                                                                         m_ArcSegmentTwo,
                                                                                         m_ArcSegmentThree);
            m_Helper.PointRelativeToOrigin(null).ReturnsForAnyArgs(m_Point);

            m_Converter = new RacetrackPathUTurnToFiguresConverter(m_Helper);
        }
开发者ID:tschroedter,项目名称:Selkie.WPF,代码行数:60,代码来源:RacetrackPathUTurnToFiguresConverterTests.cs


示例3: Point

        public void It_sets_the_new_position_to_24_24_when_the_initial_position_is_10_10_and_the_speed_is_20_and_the_direction_is_45_degrees_and_the_timeElapsed_is_1000()
        {
            var result = Calculator.CalculateNewPosition(new Point(10, 10), 45D.ToRadians(), 20, 1000);

            var expectedResult = new Point(24, -4);
            Assert.IsTrue(expectedResult.IsEqualTo(result), string.Format("{0} is not equal to {1}", expectedResult, result));
        }
开发者ID:W0dan,项目名称:CaveDwellers,代码行数:7,代码来源:When_CalculateNewPosition_is_called.cs


示例4: InfoLinkDecal

        public InfoLinkDecal()
        {
            MetaData = new InfoLinkMetaData() { Source = "http://" };
            Stretch = System.Windows.Media.Stretch.Uniform;
            Size = 1;
            CanResize = false;
            Stretch = System.Windows.Media.Stretch.None;
            Center = new System.Windows.Point(1, 1);
            PinPoint = new System.Windows.Point(1, 1);
            CanMove = false;

            OpenUrl = new DelegateCommand(() =>
            {
                if (!MetaData.Source.StartsWith("http://"))
                {
                    MetaData.Source = "http://" + MetaData.Source;
                }
            #if WINDOWS_PHONE
                Microsoft.Phone.Controls.PhoneApplicationFrame frame = Application.Current.RootVisual as Microsoft.Phone.Controls.PhoneApplicationFrame;
                frame.Navigate(new Uri(MetaData.Source));
            #elif SILVERLIGHT

                HtmlPage.Window.Navigate(new Uri(MetaData.Source), "_blank");
            #else
                Process.Start(MetaData.Source);
            #endif
            }, CanOpenUrl);
        }
开发者ID:luiseduardohdbackup,项目名称:dotnet-1,代码行数:28,代码来源:InfoLinkDecal.cs


示例5: PerpendicularLine

        public static WPFMEDIA.LineGeometry PerpendicularLine(WPF.Point StartPoint, WPF.Point EndPoint, double Length)
        {
            //Get Current Angle Don't need the actual angle, radians is fine.
            double angle = CurrentAngle(StartPoint, EndPoint);
            double radians = Math.Atan2(StartPoint.Y - EndPoint.Y, StartPoint.X - EndPoint.X);

            //Take 90 deg
            double newAngle = angle + 90;
            double newRadians = radians + Math.PI / 2;

            //need to determine the shift.

            double shiftX = Length * Math.Cos(newRadians);
            //double shiftX2 = Length * Math.Cos(newAngle * Math.PI / 180);

            double shiftY = Length * Math.Sin(newRadians);

            double newStartPointX = StartPoint.X - shiftX;
            double newStartPointY = StartPoint.Y - shiftY;

            double newEndPointX = StartPoint.X + shiftX;
            double newEndPointY = StartPoint.Y + shiftY;

            WPF.Point newStartPoint = new WPF.Point(newStartPointX, newStartPointY);
            WPF.Point newEndPoint = new WPF.Point(newEndPointX, newEndPointY);

            //get the second point

            //draw line from center of the point.
            WPFMEDIA.LineGeometry newLine = new System.Windows.Media.LineGeometry(newStartPoint, newEndPoint);
            return newLine;
        }
开发者ID:RookieOne,项目名称:Adorners,代码行数:32,代码来源:Primitives.cs


示例6: OnPlacementCallback

 private static CustomPopupPlacement[] OnPlacementCallback(Size popupSize, Size targetSize, Point offset) {
     return new[] {
         new CustomPopupPlacement {
             Point = new Point(0, targetSize.Height)
         }
     };
 }
开发者ID:gro-ove,项目名称:actools,代码行数:7,代码来源:ModernPopup.xaml.cs


示例7: Arc

        public void Arc(object backend, double xc, double yc, double radius, double angle1, double angle2, bool inverse)
        {
            var c = (DrawingContext)backend;

            if (angle1 == angle2)
                return;

            if (angle1 > angle2)
                angle2 += (Math.Truncate (angle1 / 360) + 1) * 360;

            double nextAngle;

            do {
                nextAngle = angle2 - angle1 < 360 ? angle2 : angle1 + 359;

                var p1 = new SW.Point (xc + radius * Math.Cos (angle1 * Math.PI / 180.0), yc + radius * Math.Sin (angle1 * Math.PI / 180.0));
                var p2 = new SW.Point (xc + radius * Math.Cos (nextAngle * Math.PI / 180.0), yc + radius * Math.Sin (nextAngle * Math.PI / 180.0));

                c.ConnectToLastFigure (p1, true);

                var largeArc = inverse ? nextAngle - angle1 < 180 : nextAngle - angle1 > 180;
                var direction = inverse ? SweepDirection.Counterclockwise : SweepDirection.Clockwise;
                c.Path.Segments.Add (new ArcSegment (p2, new SW.Size (radius, radius), 0, largeArc, direction, true));
                angle1 = nextAngle;
                c.EndPoint = p2;
            }
            while (nextAngle < angle2);
        }
开发者ID:jbeaurain,项目名称:xwt,代码行数:28,代码来源:ContextBackendHandler.cs


示例8: Character

 /// <summary>
 /// Initializes a new character instance.
 /// </summary>
 /// <param name="p0">Lower left character position.</param>
 /// <param name="size">Size of the character.</param>
 /// <param name="uiTaskSchedule">Scheduler associated with the UI thread.</param>
 public Character(Point p0, Vector size, TaskScheduler uiTaskSchedule)
     : base(uiTaskSchedule)
 {
     this.Position = new Quadrilateral(p0, size);
     this.Gravity = CharacterGravityState.Down;
     this.Animation = CharacterAnimationState.Down;
 }
开发者ID:ronforbes,项目名称:GravityGuy,代码行数:13,代码来源:Character.cs


示例9: EllipseGeometry

		public EllipseGeometry (Point center, double radiusX, double radiusY, Transform transform)
		{
			Transform = transform;
			Center = center;
			RadiusX = radiusX;
			RadiusY = radiusY;
		}
开发者ID:alesliehughes,项目名称:olive,代码行数:7,代码来源:EllipseGeometry.cs


示例10: CustomPopupPlacementCallbackImpl

 public static CustomPopupPlacement[] CustomPopupPlacementCallbackImpl(Size popupSize, Size targetSize, Point offset)
 {
     return new []
     {
         new CustomPopupPlacement(new Point(targetSize.Width/2 - popupSize.Width/2, targetSize.Height + 14), PopupPrimaryAxis.Horizontal) 
     };
 }
开发者ID:Chandu-cuddle,项目名称:MaterialDesignInXamlToolkit,代码行数:7,代码来源:ToolTipAssist.cs


示例11: ImageJigsawRectPiece

 public ImageJigsawRectPiece(BitmapImage imageSource, int col, int row, double pieceSize)
     : base(imageSource, col, row, pieceSize)
 {
     this._origin = new Point((col * pieceSize), (double)(row * pieceSize));
     this.Position = new Point((col * pieceSize), (double)(row * pieceSize));
     base.InitShapeProperties();
 }
开发者ID:JeffJin,项目名称:JigsawPuzzel,代码行数:7,代码来源:ImageJigsawRectPiece.cs


示例12: ArrangeOverride

        protected override Size ArrangeOverride(Size finalSize)
        {
            Size inflate = new Size();

            if (finalSize.Width < totChildWidth)
                inflate.Width = (totChildWidth - finalSize.Width) / InternalChildren.Count;

            Point offset = new Point();
            if (finalSize.Width > totChildWidth)
                offset.X = -(finalSize.Width - totChildWidth)/2;

            double totalFinalWidth = 0.0;
            foreach (UIElement child in InternalChildren)
            {
                Size childFinalSize = child.DesiredSize;
                childFinalSize.Width -= inflate.Width;
                childFinalSize.Height = finalSize.Height;

                child.Arrange(new Rect(offset, childFinalSize));

                offset.Offset(childFinalSize.Width, 0);
                totalFinalWidth += childFinalSize.Width;
            }

            return new Size(totalFinalWidth, finalSize.Height);
        }
开发者ID:vebin,项目名称:PhotoBrushProject,代码行数:26,代码来源:DockableContentTabItemsPanel.cs


示例13: CalculateStartAndEndPoint

        private void CalculateStartAndEndPoint(out Point startPoint, out Point endPoint)
        {
            startPoint = new Point();
            endPoint = new Point();

            double width = this.AdornedElement.RenderSize.Width;
            double height = this.AdornedElement.RenderSize.Height;

            if (this.isSeparatorHorizontal)
            {
                endPoint.X = width;
                if (!this.IsInFirstHalf)
                {
                    startPoint.Y = height;
                    endPoint.Y = height;
                }
            }
            else
            {
                endPoint.Y = height;
                if (!this.IsInFirstHalf)
                {
                    startPoint.X = width;
                    endPoint.X = width;
                }
            }
        }
开发者ID:reecebedding,项目名称:gw2pao,代码行数:27,代码来源:InsertionAdorner.cs


示例14: Equals

		public void Equals ()
		{
			Point p = new Point (4, 5);
			Assert.IsTrue (p.Equals (new Point (4, 5)));
			Assert.IsFalse (p.Equals (new Point (5, 4)));
			Assert.IsFalse (p.Equals (new object()));
		}
开发者ID:nobled,项目名称:mono,代码行数:7,代码来源:PointTest.cs


示例15: Arrange

		/// <summary>
		/// Arranges the adorner element on the specified adorner panel.
		/// </summary>
		public override void Arrange(AdornerPanel panel, UIElement adorner, Size adornedElementSize)
		{
			Point p = new Point(0, 0);
			if (shape is Line)
			{
				var s = shape as Line;
				double x, y;
				
				if (alignment == PlacementAlignment.BottomRight)
				{
					x = s.X2;
					y = s.Y2;
				}
				else
				{
					x = s.X1;
					y = s.Y1;
				}
				p = new Point(x, y);
			} else if (shape is Polygon) {
				var pg = shape as Polygon;
				p = pg.Points[Index];
			} else if (shape is Polyline) {
				var pg = shape as Polyline;
				p = pg.Points[Index];
			}

			var transform = shape.RenderedGeometry.Transform;
			p = transform.Transform(p);
			
			adorner.Arrange(new Rect(p.X - 3.5, p.Y - 3.5, 7, 7));
		}
开发者ID:modulexcite,项目名称:WpfDesigner,代码行数:35,代码来源:PointTrackerPlacementSupport.cs


示例16: OnRender

    protected override void OnRender(DrawingContext drawingContext) {
      base.OnRender(drawingContext);
      if (packing == null) return;
      // the container should fill the whole size
      var scalingX = renderSize.Width / Packing.BinShape.Width;
      var scalingY = renderSize.Height / Packing.BinShape.Width;
      // draw container
      drawingContext.DrawRectangle(Brushes.LightGray, new Pen(Brushes.Black, 1), new Rect(new Point(0, 0), renderSize));

      var selectedBrush = Brushes.MediumSeaGreen;
      var unselectedBrush = selectedItemKey < 0 ? selectedBrush : Brushes.DarkGray;

      foreach (var t in Packing.Items) {
        var key = t.Key;
        var item = t.Value;
        var pos = Packing.Positions[key];

        var scaledPos = new Point(pos.X * scalingX, pos.Y * scalingY);

        var scaledSize = pos.Rotated ?
          new Size(item.Height * scalingX, item.Width * scalingY) :
          new Size(item.Width * scalingX, item.Height * scalingY);

        var brush = key == selectedItemKey ? selectedBrush : unselectedBrush;
        drawingContext.DrawRectangle(brush, new Pen(Brushes.Black, 1), new Rect(scaledPos, scaledSize));
      }
    }
开发者ID:t-h-e,项目名称:HeuristicLab,代码行数:27,代码来源:Container2DView.xaml.cs


示例17: SetVolumeFromPosition

 private void SetVolumeFromPosition(Point position)
 {
     var volume = position.X / VolumeMax.Width;
     if (volume < 0) volume = 0;
     if (volume > 10) volume = 10;
     SetVolume(volume);
 }
开发者ID:chris-tomich,项目名称:Glyma,代码行数:7,代码来源:VolumeControl.xaml.cs


示例18: ImageMouseLeftButtonDown

 private void ImageMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     var img = (Image)sender;
     img.CaptureMouse();
     _startImgMove = e.GetPosition(viewImg);
     _originImgMove = new Point(viewImg.HorizontalOffset, viewImg.VerticalOffset);
 }
开发者ID:wegorich,项目名称:UltimateCommander-WPF-file-Manager,代码行数:7,代码来源:MoveImg.cs


示例19: Update

        /// <summary>
        /// Updates the canvas information (for if canvas size changes)
        /// </summary>
        public void Update(Size canvasSize, int gridSize)
        {
            var previousSize = CanvasSize;

            Center = new Point(canvasSize.Width / 2, canvasSize.Height / 2);

            RotationTransform = new RotateTransform(45, Center.X, Center.Y);
            FlipTransform = new ScaleTransform(1, -1, Center.X, Center.Y);
            Transforms = new TransformGroup();
            Transforms.Children.Add(RotationTransform);
            Transforms.Children.Add(FlipTransform);

            RotationTransformReverse = new RotateTransform(-45, Center.X, Center.Y);
            TransformsReverse = new TransformGroup();
            TransformsReverse.Children.Add(FlipTransform);
            TransformsReverse.Children.Add(RotationTransform);

            CanvasSize = canvasSize;
            Grid = new Size((int)(canvasSize.Width / gridSize), (int)(canvasSize.Height / gridSize));
            GridSquareSize = new Size(gridSize, gridSize);
            LastCanvas = this;

            ClipRegion = new RectangleGeometry(new Rect(new Point(20, 20), new Size(canvasSize.Width - 40, canvasSize.Height - 40)));

            if (OnCanvasSizeChanged != null && !previousSize.Equals(CanvasSize))
                OnCanvasSizeChanged(previousSize, CanvasSize);
        }
开发者ID:MGramolini,项目名称:Trinity,代码行数:30,代码来源:CanvasData.cs


示例20: ZoomingChanged

        private void ZoomingChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
            if (Handler != null)
            {
                var oldlocation = new Point(Handler.ActualWidth / 2 / Handler.Zoom, Handler.ActualHeight / 2 / Handler.Zoom);
                var newLocation = oldlocation;

                if (!e.NewValue.Equals(e.OldValue))
                {
                    if (e.NewValue > e.OldValue)
                    {
                        for (var i = e.NewValue; i > e.OldValue; i--)
                        {
                            Handler.ZoomIn();
                            newLocation.Y = newLocation.Y * 0.9;
                            newLocation.X = newLocation.X * 0.9;
                        }
                    }
                    else if (e.NewValue < e.OldValue)
                    {
                        for (var i = e.NewValue; i < e.OldValue; i++)
                        {
                            Handler.ZoomOut();
                            newLocation.Y = newLocation.Y / 0.9;
                            newLocation.X = newLocation.X / 0.9;
                        }
                    }
                    var y = newLocation.Y - oldlocation.Y;
                    var x = newLocation.X - oldlocation.X;

                    Handler.MoveMap(x, y);
                }
                
            }        
        }
开发者ID:chris-tomich,项目名称:Glyma,代码行数:35,代码来源:Zooming.xaml.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Windows.PresentationSource类代码示例发布时间:2022-05-26
下一篇:
C# Windows.Int32Rect类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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