Exemple #1
0
        /// <summary>
        /// Shows the tracker.
        /// </summary>
        /// <param name="data">The data.</param>
        public void ShowTracker(TrackerHitResult data)
        {
            if (this.trackerLabel == null)
            {
                // Holding the tracker label inside an EventBox allows
                // us to set the background color
                Gtk.EventBox labelHolder = new Gtk.EventBox();
                this.trackerLabel = new Gtk.Label();
                this.trackerLabel.SetPadding(3, 3);
                OxyColor bgColor = OxyColors.LightSkyBlue;
                labelHolder.ModifyBg(StateType.Normal, new Gdk.Color(bgColor.R, bgColor.G, bgColor.B));
                labelHolder.Add(this.trackerLabel);
                this.Add(labelHolder);
                labelHolder.ShowAll();
            }
            this.trackerLabel.Parent.Visible = true;
            this.trackerLabel.Text           = data.ToString();
            Gtk.Requisition req  = this.trackerLabel.Parent.SizeRequest();
            int             xPos = (int)data.Position.X - req.Width / 2;
            int             yPos = (int)data.Position.Y - req.Height;

            xPos = Math.Max(0, Math.Min(xPos, this.Allocation.Width - req.Width));
            yPos = Math.Max(0, Math.Min(yPos, this.Allocation.Height - req.Height));
            this.Move(trackerLabel.Parent, xPos, yPos);
        }
        /// <summary>
        /// Shows the tracker.
        /// </summary>
        /// <param name="data">The data.</param>
        public void ShowTracker(TrackerHitResult data)
        {
            if (this.trackerLabel == null)
            {
                this.trackerLabel = new Label {
                    Parent = this, BackColor = Color.LightSkyBlue, AutoSize = true, Padding = new Padding(5)
                };
            }

            this.trackerLabel.Text    = data.ToString();
            this.trackerLabel.Top     = (int)data.Position.Y - this.trackerLabel.Height;
            this.trackerLabel.Left    = (int)data.Position.X - this.trackerLabel.Width / 2;
            this.trackerLabel.Visible = true;
        }
Exemple #3
0
 /// <summary>
 /// Shows the tracker.
 /// </summary>
 /// <param name="data">The data.</param>
 public void ShowTracker(TrackerHitResult data)
 {
     if (this.trackerLabel == null)
     {
         // Holding the tracker label inside an EventBox allows
         // us to set the background color
         Gtk.EventBox labelHolder = new Gtk.EventBox();
         this.trackerLabel = new Gtk.Label();
         this.trackerLabel.SetPadding(3, 3);
         OxyColor bgColor = OxyColors.LightSkyBlue;
         labelHolder.ModifyBg(StateType.Normal, new Gdk.Color(bgColor.R, bgColor.G, bgColor.B));
         labelHolder.Add(this.trackerLabel);
         this.Add(labelHolder);
         labelHolder.ShowAll();
     }
     this.trackerLabel.Parent.Visible = true;
     this.trackerLabel.Text = data.ToString();
     Gtk.Requisition req = this.trackerLabel.Parent.SizeRequest();
     int xPos = (int)data.Position.X - req.Width / 2;
     int yPos = (int)data.Position.Y - req.Height;
     xPos = Math.Max(0, Math.Min(xPos, this.Allocation.Width - req.Width));
     yPos = Math.Max(0, Math.Min(yPos, this.Allocation.Height - req.Height));
     this.Move(trackerLabel.Parent, xPos, yPos);
 }
Exemple #4
0
        /// <summary>
        /// Shows the tracker.
        /// </summary>
        /// <param name="data">The data.</param>
        public void ShowTracker(TrackerHitResult data)
        {
            if (this.trackerLabel == null)
            {
                this.trackerLabel = new Label { Parent = this, BackColor = Color.LightSkyBlue, AutoSize = true };
            }

            this.trackerLabel.Text = data.ToString();
            this.trackerLabel.Top = (int)data.Position.Y - this.Top;
            this.trackerLabel.Left = (int)data.Position.X - this.Left;
            this.trackerLabel.Visible = true;
        }