Add() public static method

Translates a by a given .

public static Add ( Point pt, Size sz ) : Point
pt Point
sz Size
return Point
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);
            }
        }
Exemplo n.º 2
0
 static IEnumerable<Point> GetPath(int startX, int startY, double dx, double dy)
 {
     var geo = new Point(startX, startY).ToGeometry();
     var deltaPoint = new PointF((float)dx, (float)dy);
     while (true)
     {
         geo = geo.Add(deltaPoint);
         yield return geo.ToMap();
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Update our coordinates to reflect a new top/left lat/long and zoom level
        /// </summary>
        /// <param name="topLeft"></param>
        /// <param name="zoomLevel"></param>
        public void UpdateFromLngLatAndZoom(PointF topLeft, int zoomLevel)
        {
            //Determine our top-left coordinates
            this.TopLeft   = topLeft;
            this.TopLeftXY = LngLatToXY(topLeft, this.ZoomLevel = zoomLevel);

            //Determine our bottom-right pixel
            this.BottomRightXY = Point.Add(TopLeftXY, DisplayRectangle.Size);
            this.BottomRight   = XYToLngLat(this.BottomRightXY, zoomLevel);
        }
Exemplo n.º 4
0
        public override void Process()
        {
            bool update = CMain.Time >= NextMotion || GameScene.CanMove;

            SkipFrames = this != User && ActionFeed.Count > 1;

            ProcessFrames();

            if (Frame == null)
            {
                DrawFrame = 0;
                DrawWingFrame = 0;
            }
            else
            {
                DrawFrame = Frame.Start + (Frame.OffSet * (byte)Direction) + FrameIndex;
                DrawWingFrame = Frame.EffectStart + (Frame.EffectOffSet * (byte)Direction) + EffectFrameIndex;
            }

            #region Moving OffSet

            switch (CurrentAction)
            {
                case MirAction.Walking:
                case MirAction.Running:
                case MirAction.MountWalking:
                case MirAction.MountRunning:
                case MirAction.Pushed:
                case MirAction.DashL:
                case MirAction.DashR:
                case MirAction.Sneek:
                case MirAction.Jump:
                case MirAction.DashAttack:
                    if (Frame == null)
                    {
                        OffSetMove = Point.Empty;
                        Movement = CurrentLocation;
                        break;
                    }

                    var i = 0;
                    if (CurrentAction == MirAction.MountRunning) i = 3;
                    else if (CurrentAction == MirAction.Running)
                        i = (Sprint && !Sneaking ? 3 : 2);
                    else i = 1;

                    if (CurrentAction == MirAction.Jump) i = -JumpDistance;
                    if (CurrentAction == MirAction.DashAttack) i = JumpDistance;

                    Movement = Functions.PointMove(CurrentLocation, Direction, CurrentAction == MirAction.Pushed ? 0 : -i);

                    int count = Frame.Count;
                    int index = FrameIndex;

                    if (CurrentAction == MirAction.DashR || CurrentAction == MirAction.DashL)
                    {
                        count = 3;
                        index %= 3;
                    }

                    switch (Direction)
                    {
                        case MirDirection.Up:
                            OffSetMove = new Point(0, (int)((MapControl.CellHeight * i / (float)(count)) * (index + 1)));
                            break;
                        case MirDirection.UpRight:
                            OffSetMove = new Point((int)((-MapControl.CellWidth * i / (float)(count)) * (index + 1)), (int)((MapControl.CellHeight * i / (float)(count)) * (index + 1)));
                            break;
                        case MirDirection.Right:
                            OffSetMove = new Point((int)((-MapControl.CellWidth * i / (float)(count)) * (index + 1)), 0);
                            break;
                        case MirDirection.DownRight:
                            OffSetMove = new Point((int)((-MapControl.CellWidth * i / (float)(count)) * (index + 1)), (int)((-MapControl.CellHeight * i / (float)(count)) * (index + 1)));
                            break;
                        case MirDirection.Down:
                            OffSetMove = new Point(0, (int)((-MapControl.CellHeight * i / (float)(count)) * (index + 1)));
                            break;
                        case MirDirection.DownLeft:
                            OffSetMove = new Point((int)((MapControl.CellWidth * i / (float)(count)) * (index + 1)), (int)((-MapControl.CellHeight * i / (float)(count)) * (index + 1)));
                            break;
                        case MirDirection.Left:
                            OffSetMove = new Point((int)((MapControl.CellWidth * i / (float)(count)) * (index + 1)), 0);
                            break;
                        case MirDirection.UpLeft:
                            OffSetMove = new Point((int)((MapControl.CellWidth * i / (float)(count)) * (index + 1)), (int)((MapControl.CellHeight * i / (float)(count)) * (index + 1)));
                            break;
                    }

                    OffSetMove = new Point(OffSetMove.X % 2 + OffSetMove.X, OffSetMove.Y % 2 + OffSetMove.Y);
                    break;
                default:
                    OffSetMove = Point.Empty;
                    Movement = CurrentLocation;
                    break;
            }

            #endregion

            DrawY = Movement.Y > CurrentLocation.Y ? Movement.Y : CurrentLocation.Y;

            DrawLocation = new Point((Movement.X - User.Movement.X + MapControl.OffSetX) * MapControl.CellWidth, (Movement.Y - User.Movement.Y + MapControl.OffSetY) * MapControl.CellHeight);

            if (this != User)
            {
                DrawLocation.Offset(User.OffSetMove);
                DrawLocation.Offset(-OffSetMove.X, -OffSetMove.Y);
            }

            if (BodyLibrary != null && update)
            {
                FinalDrawLocation = DrawLocation.Add(BodyLibrary.GetOffSet(DrawFrame));
                DisplayRectangle = new Rectangle(DrawLocation, BodyLibrary.GetTrueSize(DrawFrame));
            }

            for (int i = 0; i < Effects.Count; i++)
                Effects[i].Process();

            Color colour = DrawColour;
            DrawColour = Color.White;
            if (Poison != PoisonType.None)
            {

                if (Poison.HasFlag(PoisonType.Green))
                    DrawColour = Color.Green;
                if (Poison.HasFlag(PoisonType.Red))
                    DrawColour = Color.Red;
                if (Poison.HasFlag(PoisonType.Bleeding))
                    DrawColour = Color.DarkRed;
                if (Poison.HasFlag(PoisonType.Slow))
                    DrawColour = Color.Purple;
                if (Poison.HasFlag(PoisonType.Stun))
                    DrawColour = Color.Yellow;
                if (Poison.HasFlag(PoisonType.Frozen))
                    DrawColour = Color.Blue;
                if (Poison.HasFlag(PoisonType.Paralysis))
                    DrawColour = Color.Gray;
                if (Poison.HasFlag(PoisonType.DelayedExplosion))
                    DrawColour = Color.Orange;
            }

            if (colour != DrawColour) GameScene.Scene.MapControl.TextureValid = false;
        }
Exemplo n.º 5
0
        public override void Process()
        {
            bool update = CMain.Time >= NextMotion || GameScene.CanMove;
            SkipFrames = ActionFeed.Count > 1;

            ProcessFrames();

            if (Frame == null)
                DrawFrame = 0;
            else DrawFrame = Frame.Start + (Frame.OffSet * (byte)Direction) + FrameIndex;

            #region Moving OffSet

            switch (CurrentAction)
            {
                case MirAction.Walking:
                case MirAction.Running:
                case MirAction.Pushed:
                case MirAction.DashL:
                case MirAction.DashR:
                    if (Frame == null)
                    {
                        OffSetMove = Point.Empty;
                        Movement = CurrentLocation;
                        break;
                    }
                    int i = CurrentAction == MirAction.Running ? 2 : 1;

                    Movement = Functions.PointMove(CurrentLocation, Direction, CurrentAction == MirAction.Pushed ? 0 : -i);

                    int count = Frame.Count;
                    int index = FrameIndex;

                    if (CurrentAction == MirAction.DashR || CurrentAction == MirAction.DashL)
                    {
                        count = 3;
                        index %= 3;
                    }

                    switch (Direction)
                    {
                        case MirDirection.Up:
                            OffSetMove = new Point(0, (int)((MapControl.CellHeight * i / (float)(count)) * (index + 1)));
                            break;
                        case MirDirection.UpRight:
                            OffSetMove = new Point((int)((-MapControl.CellWidth * i / (float)(count)) * (index + 1)), (int)((MapControl.CellHeight * i / (float)(count)) * (index + 1)));
                            break;
                        case MirDirection.Right:
                            OffSetMove = new Point((int)((-MapControl.CellWidth * i / (float)(count)) * (index + 1)), 0);
                            break;
                        case MirDirection.DownRight:
                            OffSetMove = new Point((int)((-MapControl.CellWidth * i / (float)(count)) * (index + 1)), (int)((-MapControl.CellHeight * i / (float)(count)) * (index + 1)));
                            break;
                        case MirDirection.Down:
                            OffSetMove = new Point(0, (int)((-MapControl.CellHeight * i / (float)(count)) * (index + 1)));
                            break;
                        case MirDirection.DownLeft:
                            OffSetMove = new Point((int)((MapControl.CellWidth * i / (float)(count)) * (index + 1)), (int)((-MapControl.CellHeight * i / (float)(count)) * (index + 1)));
                            break;
                        case MirDirection.Left:
                            OffSetMove = new Point((int)((MapControl.CellWidth * i / (float)(count)) * (index + 1)), 0);
                            break;
                        case MirDirection.UpLeft:
                            OffSetMove = new Point((int)((MapControl.CellWidth * i / (float)(count)) * (index + 1)), (int)((MapControl.CellHeight * i / (float)(count)) * (index + 1)));
                            break;
                    }

                    OffSetMove = new Point(OffSetMove.X % 2 + OffSetMove.X, OffSetMove.Y % 2 + OffSetMove.Y);
                    break;
                default:
                    OffSetMove = Point.Empty;
                    Movement = CurrentLocation;
                    break;
            }

            #endregion

            DrawY = Movement.Y > CurrentLocation.Y ? Movement.Y : CurrentLocation.Y;

            DrawLocation = new Point((Movement.X - User.Movement.X + MapControl.OffSetX) * MapControl.CellWidth, (Movement.Y - User.Movement.Y + MapControl.OffSetY) * MapControl.CellHeight);
            DrawLocation.Offset(-OffSetMove.X, -OffSetMove.Y);
            DrawLocation.Offset(User.OffSetMove);
            DrawLocation = DrawLocation.Add(ManualLocationOffset);

            if (BodyLibrary != null && update)
            {
                FinalDrawLocation = DrawLocation.Add(BodyLibrary.GetOffSet(DrawFrame));
                DisplayRectangle = new Rectangle(DrawLocation, BodyLibrary.GetTrueSize(DrawFrame));
            }

            for (int i = 0; i < Effects.Count; i++)
                Effects[i].Process();

            Color colour = DrawColour;

            switch (Poison)
            {
                case PoisonType.None:
                    DrawColour = Color.White;
                    break;
                case PoisonType.Green:
                    DrawColour = Color.Green;
                    break;
                case PoisonType.Red:
                    DrawColour = Color.Red;
                    break;
                case PoisonType.Bleeding:
                    DrawColour = Color.DarkRed;
                    break;
                case PoisonType.Slow:
                    DrawColour = Color.Purple;
                    break;
                case PoisonType.Stun:
                    DrawColour = Color.Yellow;
                    break;
                case PoisonType.Frozen:
                    DrawColour = Color.Blue;
                    break;
                case PoisonType.Paralysis:
                    DrawColour = Color.Gray;
                    break;
                case PoisonType.DelayedExplosion://ArcherSpells - DelayedExplosion
                    DrawColour = Color.Orange;
                    break;
            }

            if (colour != DrawColour) GameScene.Scene.MapControl.TextureValid = false;
        }
		/// <summary>
		/// Center between two points
		/// </summary>
		/// <param name="p1"></param>
		/// <param name="p2"></param>
		/// <returns>Center Point</returns>
		public static Point Center(Point p1, Point p2) => p2.Add(p1).Scale(0.5f);
Exemplo n.º 7
0
        private IEnumerable <Marker> GetMarkers(ref Image <Rgb, byte> image, Rectangle roi, int width, int height, ref Image <Rgb, byte> debugImage, out List <Point[]> quadrilaterals)
        {
            if (_glyphRecognizer == null)
            {
                quadrilaterals = new List <Point[]>();
                return(null);
            }

            var imageWidth  = image.Width;
            var imageHeight = image.Height;
            var imageRoi    = image.ROI;

            var markers = new List <Marker>();

            var minFramesProperty = MinFramesProperty;

            // Draw new Roi
            if (IsRenderContent)
            {
                debugImage.Draw(roi, Rgbs.Red, 2);
            }

            _recognizedGlyphs.Clear();
            _recognizedQuads.Clear();

            var glyphs = _glyphRecognizer.FindGlyphs(image.Bitmap);

            foreach (var glyph in glyphs)
            {
                // highlight quadrilateral (of all found glyphs)
                var tmpQuad = glyph.Quadrilateral;

                if (tmpQuad == null || tmpQuad.Count != 4)
                {
                    continue;
                }

                var quad = new[]
                {
                    new Point(tmpQuad[0].X, tmpQuad[0].Y),
                    new Point(tmpQuad[1].X, tmpQuad[1].Y),
                    new Point(tmpQuad[2].X, tmpQuad[2].Y),
                    new Point(tmpQuad[3].X, tmpQuad[3].Y)
                };

                if (IsRenderContent)
                {
                    var debugImageRoi = debugImage.ROI;
                    debugImage.ROI = roi;

                    debugImage.DrawPolyline(quad, true, Rgbs.Yellow, 1);

                    debugImage.ROI = debugImageRoi;
                }

                // if glyphs are recognized then store and draw name
                var recQuad  = glyph.RecognizedQuadrilateral;
                var recGlyph = glyph.RecognizedGlyph;
                if (recQuad != null && recGlyph != null)
                {
                    _recognizedGlyphs.Add(recGlyph.Name, recGlyph);
                    _recognizedQuads.Add(recGlyph.Name, quad);

                    if (IsRenderContent)
                    {
                        var debugImageRoi = debugImage.ROI;
                        debugImage.ROI = roi;

                        var labelPos = new Point(recQuad[2].X, recQuad[2].Y);
                        debugImage.Draw(recGlyph.Name, ref EmguFontBig, labelPos, Rgbs.Green);

                        debugImage.ROI = debugImageRoi;
                    }
                }
            }

            // update all entries in glyph table using recognized glyphs

            quadrilaterals = new List <Point[]>();
            var length = _glyphTable.Length;

            for (int i = 0; i < length; i++)
            {
                var name = (i + 1).ToString(CultureInfo.InvariantCulture);

                Glyph   glyph = null;
                Point[] quad  = null;
                if (_recognizedGlyphs.ContainsKey(name))
                {
                    glyph = _recognizedGlyphs[name];
                }
                if (_recognizedQuads.ContainsKey(name))
                {
                    quad = _recognizedQuads[name];
                }

                // if glyph for this entry was recognized, update entry
                if (glyph != null && quad != null)
                {
                    quadrilaterals.Add(quad);

                    // if there is no entry yet, create it
                    if (_glyphTable[i] == null)
                    {
                        _glyphTable[i] = new GlyphMetadata();
                    }

                    var gmd = _glyphTable[i];

                    gmd.aliveFrames++;

                    Point upVector1 = quad[0].Sub(quad[3]);
                    Point upVector2 = quad[1].Sub(quad[2]);
                    upVector1 = (upVector1.Add(upVector2)).Div(2);

                    double orientation = Math.Atan2(upVector1.Y, upVector2.X);

                    // always keep only the last X frames in list
                    if (gmd.prevX.Count == minFramesProperty)
                    {
                        gmd.prevX.RemoveAt(0);
                        gmd.prevY.RemoveAt(0);
                        gmd.prevOrientations.RemoveAt(0);
                    }
                    gmd.prevX.Add(quad[0].X);
                    gmd.prevY.Add(quad[0].Y);
                    gmd.prevOrientations.Add(orientation);

                    // check if marker stops moving and rotating
                    if (Math.Abs(gmd.prevX.Max() - gmd.prevX.Min()) < 5 &&
                        Math.Abs(gmd.prevY.Max() - gmd.prevY.Min()) < 5 &&
                        gmd.aliveFrames >= minFramesProperty)
                    {
                        var x = orientation + Math.PI / 2;
                        var degOrientation = (x > 0.0 ? x : (2.0 * Math.PI + x)) * 360 / (2.0 * Math.PI);

                        // find bounding rectangle
                        float minX = image.Width;
                        float minY = image.Height;
                        float maxX = 0;
                        float maxY = 0;

                        foreach (Point p in quad)
                        {
                            minX = Math.Min(minX, p.X);
                            minY = Math.Min(minY, p.Y);
                            maxX = Math.Max(maxX, p.X);
                            maxY = Math.Max(maxY, p.Y);
                        }

                        var centerX = roi.X + minX + (maxX - minX) / 2.0f;
                        var centerY = roi.Y + minY + (maxY - minY) / 2.0f;

                        markers.Add(new Marker(this, "Display")
                        {
                            Id             = name,
                            Center         = new System.Windows.Point(centerX / width, centerY / height),
                            RelativeCenter = new System.Windows.Point(centerX / imageWidth, centerY / imageHeight),
                            Angle          = degOrientation
                        });

                        // Render center and orientation of marker
                        if (IsRenderContent)
                        {
                            var markerCenter = new PointF(centerX, centerY);
                            var p2           = new Point(
                                (int)(markerCenter.X + Math.Cos(orientation) * 100.0),
                                (int)(markerCenter.Y + Math.Sin(orientation) * 100.0)
                                );
                            var p3 = new Point(
                                (int)(markerCenter.X + Math.Cos(orientation + Math.PI / 16) * 75.0),
                                (int)(markerCenter.Y + Math.Sin(orientation + Math.PI / 16) * 75.0)
                                );

                            debugImage.Draw(new Cross2DF(markerCenter, 6, 6), Rgbs.Green, 2);
                            debugImage.Draw(new LineSegment2DF(markerCenter, p2), Rgbs.Green, 2);
                            debugImage.Draw(string.Format("{0} deg", Math.Round(degOrientation, 1)), ref EmguFont, p3, Rgbs.Green);
                        }
                    }
                    else
                    {
                        // if glyph disappeared remove entry from table
                        _recognizedGlyphs[name] = null;
                    }
                }
            }

            image.ROI = imageRoi;

            return(markers);
        }
Exemplo n.º 8
0
        public override void Process()
        {
            bool update = CMain.Time >= NextMotion || GameScene.CanMove;

            ProcessFrames();

            if (Frame == null)
                DrawFrame = 0;
            else
                DrawFrame = Frame.Start + (Frame.OffSet * (byte)Direction) + FrameIndex;

            DrawY = CurrentLocation.Y;

            DrawLocation = new Point((Movement.X - User.Movement.X + MapControl.OffSetX) * MapControl.CellWidth, (Movement.Y - User.Movement.Y + MapControl.OffSetY) * MapControl.CellHeight);
            DrawLocation.Offset(User.OffSetMove);
            if (BodyLibrary != null)
                FinalDrawLocation = DrawLocation.Add(BodyLibrary.GetOffSet(DrawFrame));

            if (BodyLibrary != null && update)
            {
                FinalDrawLocation = DrawLocation.Add(BodyLibrary.GetOffSet(DrawFrame));
                DisplayRectangle = new Rectangle(DrawLocation, BodyLibrary.GetTrueSize(DrawFrame));
            }

            for (int i = 0; i < Effects.Count; i++)
                Effects[i].Process();

            Color colour = DrawColour;

            switch (Poison)
            {
                case PoisonType.None:
                    DrawColour = Color.White;
                    break;
                case PoisonType.Green:
                    DrawColour = Color.Green;
                    break;
                case PoisonType.Red:
                    DrawColour = Color.Red;
                    break;
                case PoisonType.Slow:
                    DrawColour = Color.Purple;
                    break;
                case PoisonType.Stun:
                    DrawColour = Color.Yellow;
                    break;
                case PoisonType.Frozen:
                    DrawColour = Color.Blue;
                    break;
                case PoisonType.Paralysis:
                    DrawColour = Color.Gray;
                    break;
            }

            if (colour != DrawColour) GameScene.Scene.MapControl.TextureValid = false;
        }
Exemplo n.º 9
0
 /// <summary>Translates a <see cref="T:System.Drawing.Point" /> by a given <see cref="T:System.Drawing.Size" />.</summary>
 /// <returns>The translated <see cref="T:System.Drawing.Point" />.</returns>
 /// <param name="pt">The <see cref="T:System.Drawing.Point" /> to translate. </param>
 /// <param name="sz">A <see cref="T:System.Drawing.Size" /> that specifies the pair of numbers to add to the coordinates of <paramref name="pt" />. </param>
 /// <filterpriority>3</filterpriority>
 public static Point operator +(Point pt, Size sz)
 {
     return(Point.Add(pt, sz));
 }
Exemplo n.º 10
0
        private static void CreateHintLabel()
        {
            if (HintBaseLabel == null || HintBaseLabel.IsDisposed)
            {
                HintBaseLabel = new MirControl
                {
                    BackColour         = Color.FromArgb(128, 128, 50),
                    Border             = true,
                    DrawControlTexture = true,
                    BorderColour       = Color.Yellow,
                    ForeColour         = Color.Yellow,
                    Parent             = MirScene.ActiveScene,
                    NotControl         = true,
                    Opacity            = 0.5F
                };
            }


            if (HintTextLabel == null || HintTextLabel.IsDisposed)
            {
                HintTextLabel = new MirLabel
                {
                    AutoSize   = true,
                    BackColour = Color.Transparent,
                    ForeColour = Color.White,
                    Parent     = HintBaseLabel,
                };

                HintTextLabel.SizeChanged += (o, e) => HintBaseLabel.Size = HintTextLabel.Size;
            }

            if (MirControl.MouseControl == null || string.IsNullOrEmpty(MirControl.MouseControl.Hint))
            {
                HintBaseLabel.Visible = false;
                return;
            }

            HintBaseLabel.Visible = true;

            HintTextLabel.Text = MirControl.MouseControl.Hint;

            Point point = MPoint.Add(-HintTextLabel.Size.Width, 20);

            if (point.X + HintBaseLabel.Size.Width >= Settings.ScreenWidth)
            {
                point.X = Settings.ScreenWidth - HintBaseLabel.Size.Width - 1;
            }
            if (point.Y + HintBaseLabel.Size.Height >= Settings.ScreenHeight)
            {
                point.Y = Settings.ScreenHeight - HintBaseLabel.Size.Height - 1;
            }

            if (point.X < 0)
            {
                point.X = 0;
            }
            if (point.Y < 0)
            {
                point.Y = 0;
            }

            HintBaseLabel.Location = point;
        }
        // Public methods.
        /// <summary>
        /// Shows the tooltip.
        /// </summary>
        /// <param name="control">The control.</param>
        /// <param name="location">The location relative to the control.</param>
        /// <param name="alignment">The alignment relative to the location.</param>
        public void Show(IWin32Window control, Point location, ContentAlignment alignment)
        {
            // Create the title font.
            using (Font font = new Font(Window.DefaultFont, FontStyle.Bold))
            {
                // Compute the tooltip strings.
                this.messageTitle = NetworkStatusToolTip.message[(int)NetworkStatus.IsInternetAvailable];
                this.messageIcmp = "ICMP connectivity: {0}".FormatWith(NetworkStatus.IsInternetIcmpAvailable ? "Yes" : "No");
                this.messageHttp = "HTTP connectivity: {0}".FormatWith(NetworkStatus.IsInternetHttpAvailable ? "Yes" : "No");
                this.messageHttps = "HTTPS connectivity: {0}".FormatWith(NetworkStatus.IsInternetHttpsAvailable ? "Yes" : "No");
                this.messageUpdated = "Connectivity last checked at {0}".FormatWith(NetworkStatus.InternetAvailableLastUpdated.ToLongTimeString());

                // Compute the strings size.
                Size sizeTitle = TextRenderer.MeasureText(messageTitle, font);
                Size sizeIcmp = TextRenderer.MeasureText(messageIcmp, Window.DefaultFont);
                Size sizeHttp = TextRenderer.MeasureText(messageHttp, Window.DefaultFont);
                Size sizeHttps = TextRenderer.MeasureText(messageHttps, Window.DefaultFont);
                Size sizeUpdated = TextRenderer.MeasureText(messageUpdated, Window.DefaultFont);

                // Compute the spacing size.

                int spacing = (int)(Window.DefaultFont.SizeInPoints * spacingFactor);

                // Get the icon.
                this.icon = NetworkStatusToolTip.icons[(int)NetworkStatus.IsInternetAvailable];

                // Compute the bounds.
                this.boundsIcon = new Rectangle(new Point(spacing << 1, spacing << 1), this.icon.Size);
                this.boundsTitle = new Rectangle(this.boundsIcon.Right + (spacing << 1), this.boundsIcon.Top, sizeTitle.Width, sizeTitle.Height);
                this.boundsIcmp = new Rectangle(this.boundsTitle.Left, this.boundsTitle.Bottom + (spacing << 1), sizeIcmp.Width, sizeIcmp.Height);
                this.boundsHttp = new Rectangle(this.boundsTitle.Left, this.boundsIcmp.Bottom + spacing, sizeHttp.Width, sizeHttp.Height);
                this.boundsHttps = new Rectangle(this.boundsTitle.Left, this.boundsHttp.Bottom + spacing, sizeHttps.Width, sizeHttps.Height);
                this.boundsUpdated = new Rectangle(this.boundsTitle.Left, this.boundsHttps.Bottom + (spacing << 1), sizeUpdated.Width, sizeUpdated.Height);

                // Compute the maximum bounds.
                Rectangle boundsMax = Geometry.Max(this.boundsIcon, this.boundsTitle, this.boundsIcmp, this.boundsHttp, this.boundsHttps, this.boundsUpdated);

                // Compute the size.
                this.size = new Size(boundsMax.Width + (spacing << 2), boundsMax.Height + (spacing << 2));

                // Update the location according to the alignment.
                switch (alignment)
                {
                    case ContentAlignment.TopCenter: location = location.Add(-(this.size.Width >> 1), 0); break;
                    case ContentAlignment.TopRight: location = location.Add(-this.size.Width, 0); break;
                    case ContentAlignment.MiddleLeft: location = location.Add(0, -(this.size.Height >> 1)); break;
                    case ContentAlignment.MiddleCenter: location = location.Add(-(this.size.Width >> 1), -(this.size.Height >> 1)); break;
                    case ContentAlignment.MiddleRight: location = location.Add(-this.size.Width, -this.size.Height); break;
                    case ContentAlignment.BottomLeft: location = location.Add(0, -this.size.Height); break;
                    case ContentAlignment.BottomCenter: location = location.Add(-(this.size.Width >> 1), -this.size.Height); break;
                    case ContentAlignment.BottomRight: location = location.Add(-this.size.Width, -this.size.Height); break;
                }
            }

            // Show the tooltip.
            base.Show(" ", control, location);
        }