Exemple #1
0
        public void Render(Graphics graphics, MyPoint org, int zoom)
        {
            if (!_visible)
            {
                return;
            }

            const int height = 8;
            const int posX   = 20;
            const int hSpace = 10;

            int posY = 30;
            //int posY = ClientSize.Height - 30;

            int width = 150;

            Pen pen = new Pen(Color.Black, 2.0f);

            int textHeight = (int)_font.GetHeight();

            graphics.DrawLine(pen, posX, posY, posX + width, posY);
            graphics.DrawLine(pen, posX, posY - height, posX, posY + height);
            graphics.DrawLine(pen, posX + width, posY - height, posX + width, posY + height);

            MyPointF world0 = ScreenToWorld(org, zoom);
            MyPointF world1 = ScreenToWorld(org + new MyPoint(width, 0), zoom);

            double dist = TrackDataManager.ComputeDistance(world0.Y, world0.X, world1.Y, world1.X);

            graphics.DrawString(Units.Provider.DistanceString(dist), _font, Brushes.Black, posX + width + hSpace, posY - textHeight / 2);
        }
Exemple #2
0
        public void OnMouseMove(MyPoint origin, int zoom, MouseEventArgs e)
        {
            if (_openPair != null)
            {
                MyPoint cursor = new MyPoint(origin.X + e.X, origin.Y + e.Y);

                _openPair.WorldPos1 = ScreenToWorld(cursor, zoom);
                _openPair.Distance  = TrackDataManager.ComputeDistance(_openPair.WorldPos0.Y, _openPair.WorldPos0.X, _openPair.WorldPos1.Y, _openPair.WorldPos1.X);;
                _view.Invalidate();
            }
        }