System.Drawing.Point.Subtract C# (CSharp) Method

Subtract() public static method

Translates a by the negative of a given .

public static Subtract ( Point pt, Size sz ) : Point
pt Point
sz Size
return Point
        public static Point Subtract(Point pt, Size sz) => new Point(pt.X - sz.Width, pt.Y - sz.Height);

Same methods

Point::Subtract ( System pt, System sz ) : System.Drawing.Point

Usage Example

Exemplo n.º 1
0
        /// <summary>
        /// Update our coordinates to reflect a new top-left pixel
        /// </summary>
        /// <param name="topLeftXY">The top-left pixel</param>
        public void UpdateFromXY(Point topLeftXY)
        {
            var max = Point.Subtract(LngLatToXY(new PointF(180, -75), ZoomLevel), DisplayRectangle.Size);
            var min = LngLatToXY(new PointF(-180, 82), ZoomLevel);

            topLeftXY.X = Math.Max(Math.Min(max.X, topLeftXY.X), min.X);
            topLeftXY.Y = Math.Max(Math.Min(max.Y, topLeftXY.Y), min.Y);

            //Point.Subtract(TopLeftXY, DisplayRectangle.Size)

            PointF oldCenter = Center;

            //Update our top-left coordinates
            this.TopLeftXY = topLeftXY;
            this.TopLeft   = XYToLngLat(topLeftXY, ZoomLevel);

            //Determine our bottom-right pixel
            this.BottomRightXY = Point.Add(topLeftXY, DisplayRectangle.Size);
            this.BottomRight   = XYToLngLat(this.BottomRightXY, ZoomLevel);

            if (this.Panned != null)
            {
                this.Panned(oldCenter, Center);
            }
        }
All Usage Examples Of System.Drawing.Point::Subtract