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


C# ScreenPoint类代码示例

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


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

示例1: HitTestResult

 /// <summary>
 /// Initializes a new instance of the <see cref="HitTestResult" /> class.
 /// </summary>
 /// <param name="element">The element that was hit.</param>
 /// <param name="nearestHitPoint">The nearest hit point.</param>
 /// <param name="item">The item.</param>
 /// <param name="index">The index.</param>
 public HitTestResult(UIElement element, ScreenPoint nearestHitPoint, object item = null, double index = 0)
 {
     this.Element = element;
     this.NearestHitPoint = nearestHitPoint;
     this.Item = item;
     this.Index = index;
 }
开发者ID:benjaminrupp,项目名称:oxyplot,代码行数:14,代码来源:HitTestResult.cs

示例2: ColorPicker

        /// <summary>
        /// Erzeugt eine neue Instanz eines ColorPicker-Objekts und initialisiert diese
        /// mit der Farbe, auf welche der Farbwähler beim Aufruf aus Sicht des Spielers zeigt.
        /// </summary>
        public ColorPicker(IScreen screen, DisplayLayer drawOrder, Color def)
            : base(screen, drawOrder)
        {
            tileSize = new ScreenPoint (screen, 0.032f, 0.032f);

            // Widget-Attribute
            BackgroundColorFunc = (s) => Design.WidgetBackground;
            ForegroundColorFunc = (s) => Design.WidgetForeground;
            AlignX = HorizontalAlignment.Left;
            AlignY = VerticalAlignment.Top;

            // die Farb-Tiles
            colors = new List<Color> (CreateColors (64));
            colors.Sort (ColorHelper.SortColorsByLuminance);
            tiles = new List<ScreenPoint> (CreateTiles (colors));

            // einen Spritebatch
            spriteBatch = new SpriteBatch (screen.GraphicsDevice);

            // Position und Größe
            Bounds.Position = ScreenPoint.Centered (screen, Bounds);
            Bounds.Size.RelativeFunc = () => {
                float sqrt = (float)Math.Ceiling (Math.Sqrt (colors.Count));
                return tileSize * sqrt;
            };

            // Die Callback-Funktion zur Selektion setzt das SelectedColor-Attribut
            ColorSelected += (color, time) => {
                SelectedColor = color;
            };
        }
开发者ID:knot3,项目名称:knot3-code,代码行数:35,代码来源:ColorPicker.cs

示例3: GetNearestPoint

        private static DataPoint? GetNearestPoint(ISeries s, ScreenPoint point, bool snap, bool pointsOnly)
        {
            if (s == null)
                return null;

            if (snap || pointsOnly)
            {
                ScreenPoint spn;
                DataPoint dpn;
                if (s.GetNearestPoint(point, out dpn, out spn) && snap)
                {
                    if (spn.DistanceTo(point) < 20)
                        return dpn;
                }
            }

            ScreenPoint sp;
            DataPoint dp;

            if (!pointsOnly)
                if (s.GetNearestInterpolatedPoint(point, out dp, out sp))
                    return dp;

            return null;
        }
开发者ID:AndrewTPohlmann,项目名称:open-hardware-monitor,代码行数:25,代码来源:SliderAction.cs

示例4: OxyTouchEventArgs

        /// <summary>
        /// Initializes a new instance of the <see cref="OxyTouchEventArgs" /> class.
        /// </summary>
        /// <param name="currentTouches">The current touches.</param>
        /// <param name="previousTouches">The previous touches.</param>
        public OxyTouchEventArgs(ScreenPoint[] currentTouches, ScreenPoint[] previousTouches)
        {
            this.Position = currentTouches[0];

            if (currentTouches.Length == previousTouches.Length)
            {
                this.DeltaTranslation = currentTouches[0] - previousTouches[0];
            }

            double scale = 1;
            if (currentTouches.Length > 1 && currentTouches.Length == previousTouches.Length)
            {
                var currentDistance = (currentTouches[1] - currentTouches[0]).Length;
                var previousDistance = (previousTouches[1] - previousTouches[0]).Length;
                scale = currentDistance / previousDistance;

                if (scale < 0.5)
                {
                    scale = 0.5;
                }

                if (scale > 2)
                {
                    scale = 2;
                }
            }

            this.DeltaScale = new ScreenVector(scale, scale);
        }
开发者ID:Celderon,项目名称:oxyplot,代码行数:34,代码来源:OxyTouchEventArgs.cs

示例5: TweenEffect

        public TweenEffect(ScreenPoint startpoint, ScreenPoint endpoint, int time)
        {
            this.StartLocation = startpoint;
            this.EndLocation = endpoint;
            this.CurrentLocation = new ScreenPoint(this.StartLocation.X, this.StartLocation.Y);

            this.Time = time;
            this.Finished = (endpoint.X == startpoint.X && endpoint.Y == startpoint.Y);
        }
开发者ID:NullSoldier,项目名称:Valkyrie,代码行数:9,代码来源:TweenEffect.cs

示例6: EmptyArray

 public void EmptyArray()
 {
     var points = new ScreenPoint[0];
     var clippingRectangle = new OxyRect(0.3, -0.5, 0.5, 1);
     var rc = Substitute.For<IRenderContext>();
     var received = new List<ScreenPoint>();
     rc.DrawClippedLine(clippingRectangle, points, 1, OxyColors.Black, 1, null, LineJoin.Miter, false, null, received.AddRange);
     Assert.AreEqual(0, received.Count);
 }
开发者ID:benjaminrupp,项目名称:oxyplot,代码行数:9,代码来源:RenderingExtensionsTests.cs

示例7: EndpointsOutsideArea

 public void EndpointsOutsideArea()
 {
     var clipping = new CohenSutherlandClipping(new OxyRect(0, 0, 1, 1));
     var p0 = new ScreenPoint(0.3, -0.2);
     var p1 = new ScreenPoint(0.6, 1.3);
     Assert.IsTrue(clipping.ClipLine(ref p0, ref p1));
     Assert.AreEqual(0, p0.Y);
     Assert.AreEqual(1, p1.Y);
 }
开发者ID:benjaminrupp,项目名称:oxyplot,代码行数:9,代码来源:CohenSutherlandClippingTests.cs

示例8: OnMouseMove

        public override void OnMouseMove(ScreenPoint pt, bool control, bool shift)
        {
            if (currentSeries == null)
                return;

            var current = GetNearestPoint(currentSeries, pt, !control, shift);
            if (current != null)
                pc.ShowSlider(currentSeries, current.Value);
        }
开发者ID:AndrewTPohlmann,项目名称:open-hardware-monitor,代码行数:9,代码来源:SliderAction.cs

示例9: EndpointsOutsideArea2

 public void EndpointsOutsideArea2()
 {
     var clipping = new CohenSutherlandClipping(new OxyRect(0.3, -0.5, 0.5, 1));
     var p0 = new ScreenPoint(0, 0);
     var p1 = new ScreenPoint(1, 0);
     Assert.IsTrue(clipping.ClipLine(ref p0, ref p1));
     Assert.AreEqual(new ScreenPoint(0.3, 0), p0);
     Assert.AreEqual(new ScreenPoint(0.8, 0), p1);
 }
开发者ID:benjaminrupp,项目名称:oxyplot,代码行数:9,代码来源:CohenSutherlandClippingTests.cs

示例10: ClipLine_LineOutsideArea

 public void ClipLine_LineOutsideArea()
 {
     var clipping = new CohenSutherlandClipping(0, 1, 0, 1);
     var p0 = new ScreenPoint(0.3, -0.2);
     var p1 = new ScreenPoint(0.6, -0.2);
     Assert.IsFalse(clipping.ClipLine(ref p0, ref p1));
     Assert.AreEqual(-0.2, p0.Y);
     Assert.AreEqual(-0.2, p1.Y);
 }
开发者ID:aleksanderkobylak,项目名称:oxyplot,代码行数:9,代码来源:CohenSutherlandClippingTests.cs

示例11: ClipLine_EndpointsInsideArea

 public void ClipLine_EndpointsInsideArea()
 {
     var clipping = new CohenSutherlandClipping(0, 1, 0, 1);
     var p0 = new ScreenPoint(0.3, 0.2);
     var p1 = new ScreenPoint(0.6, 0.8);
     Assert.IsTrue(clipping.ClipLine(ref p0, ref p1));
     Assert.AreEqual(0.2, p0.Y);
     Assert.AreEqual(0.8, p1.Y);
 }
开发者ID:aleksanderkobylak,项目名称:oxyplot,代码行数:9,代码来源:CohenSutherlandClippingTests.cs

示例12: GetTouchPoints

        /// <summary>
        /// Gets the touch points from the specified <see cref="MotionEvent" /> argument.
        /// </summary>
        /// <param name="e">The event arguments.</param>
        /// <param name = "scale">The resolution scale factor.</param>
        /// <returns>The touch points.</returns>
        public static ScreenPoint[] GetTouchPoints(this MotionEvent e, double scale)
        {
            var result = new ScreenPoint[e.PointerCount];
            for (int i = 0; i < e.PointerCount; i++)
            {
                result[i] = new ScreenPoint(e.GetX(i) / scale, e.GetY(i) / scale);
            }

            return result;
        }
开发者ID:Cheesebaron,项目名称:oxyplot,代码行数:16,代码来源:ExtensionMethods.cs

示例13: BaseCamera

        public BaseCamera(int x, int y, int width, int height)
        {
            this.screen = new Rectangle(x, y, width, height);
            this.halfscreen = new ScreenPoint(screen.Width / 2, screen.Height / 2);

            this.Viewport = new Viewport()
            {
                X = x,
                Y = y,
                Width = width,
                Height = height
            };
        }
开发者ID:NullSoldier,项目名称:Valkyrie,代码行数:13,代码来源:BaseCamera.cs

示例14: ImageAnnotation

 /// <summary>
 /// Initializes a new instance of the <see cref="ImageAnnotation"/> class.
 /// </summary>
 /// <param name="image">
 /// The image.
 /// </param>
 /// <param name="position">
 /// The position in screen coordinates.
 /// </param>
 /// <param name="horizontalAlignment">
 /// The horizontal alignment.
 /// </param>
 /// <param name="verticalAlignment">
 /// The vertical alignment.
 /// </param>
 public ImageAnnotation(
     OxyImage image, 
     ScreenPoint position, 
     HorizontalAlignment horizontalAlignment = OxyPlot.HorizontalAlignment.Center, 
     VerticalAlignment verticalAlignment = OxyPlot.VerticalAlignment.Middle)
     : this()
 {
     this.ImageSource = image;
     this.X = new PlotLength(position.X, PlotLengthUnit.ScreenUnits);
     this.Y = new PlotLength(position.Y, PlotLengthUnit.ScreenUnits);
     this.HorizontalAlignment = horizontalAlignment;
     this.VerticalAlignment = verticalAlignment;
 }
开发者ID:AndrewTPohlmann,项目名称:open-hardware-monitor,代码行数:28,代码来源:ImageAnnotation.cs

示例15: GetNearestPoint

        /// <summary>
        /// Gets the point on the series that is nearest the specified point.
        /// </summary>
        /// <param name="point">The point.</param>
        /// <param name="interpolate">Interpolate the series if this flag is set to <c>true</c>.</param>
        /// <returns>A TrackerHitResult for the current hit.</returns>
        public override TrackerHitResult GetNearestPoint(ScreenPoint point, bool interpolate)
        {
            if (this.XAxis == null || this.YAxis == null)
            {
                return null;
            }

            if (interpolate)
            {
                return null;
            }

            TrackerHitResult result = null;

            // http://paulbourke.net/geometry/pointlineplane/
            double minimumDistance = double.MaxValue;
            var points = this.ActualPoints;

            for (int i = 0; i < points.Count; i++)
            {
                var p1 = points[i];
                var basePoint = new DataPoint(p1.X, this.Base);
                var sp1 = this.Transform(p1);
                var sp2 = this.Transform(basePoint);
                var u = ScreenPointHelper.FindPositionOnLine(point, sp1, sp2);

                if (double.IsNaN(u))
                {
                    continue;
                }

                if (u < 0 || u > 1)
                {
                    continue; // outside line
                }

                var sp = sp1 + ((sp2 - sp1) * u);
                double distance = (point - sp).LengthSquared;

                if (distance < minimumDistance)
                {
                    result = new TrackerHitResult(
                        this, new DataPoint(p1.X, p1.Y), new ScreenPoint(sp1.x, sp1.y), this.GetItem(i));
                    minimumDistance = distance;
                }
            }

            return result;
        }
开发者ID:Cheesebaron,项目名称:oxyplot,代码行数:55,代码来源:StemSeries.cs


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