예제 #1
0
        private void OnMouseHover(object sender, System.EventArgs e)
        {
            if (tipWindow != null)
            {
                tipWindow.Close();
            }

            if (settings.GetSetting("Gui.ResultTabs.ErrorsTab.ToolTipsEnabled", false) && hoverIndex >= 0 && hoverIndex < detailList.Items.Count)
            {
                Graphics g = Graphics.FromHwnd(detailList.Handle);

                Rectangle itemRect = detailList.GetItemRectangle(hoverIndex);
                string    text     = detailList.Items[hoverIndex].ToString();

                SizeF sizeNeeded      = g.MeasureString(text, detailList.Font);
                bool  expansionNeeded =
                    itemRect.Width < (int)sizeNeeded.Width ||
                    itemRect.Height < (int)sizeNeeded.Height;

                if (expansionNeeded)
                {
                    tipWindow            = new TipWindow(detailList, hoverIndex);
                    tipWindow.ItemBounds = itemRect;
                    tipWindow.TipText    = text;
                    tipWindow.Expansion  = TipWindow.ExpansionStyle.Both;
                    tipWindow.Overlay    = true;
                    tipWindow.WantClicks = true;
                    tipWindow.Closed    += new EventHandler(tipWindow_Closed);
                    tipWindow.Show();
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Show a "tip of the day"-like message on the top right corner of the given window.
        /// </summary>
        /// <param name="form">The owner window.</param>
        /// <param name="key">The key used to store informations about messages the user already saw. Every messages is only displayed once.</param>
        /// <param name="title">The title of the tip window.</param>
        /// <param name="tiptext">The text of the tip window.</param>
        public static void ShowTip(Form form, string key, string title, string tiptext)
        {
            lock (m_lockObject)
            {
                if (!Settings.UI.ConfirmedTips.Contains(key))
                {
                    TipWindow tw = new TipWindow(title, tiptext, key);
                    form.Controls.Add(tw);

                    // Aligns the top right corner of the tip window with the top right corner of the owner's client rectangle.
                    tw.Location = new Point(form.ClientRectangle.Left + form.ClientSize.Width - tw.Width,
                        form.ClientRectangle.Top);
                    tw.Anchor = AnchorStyles.Top | AnchorStyles.Right;
                    tw.BringToFront();
                    tw.Show();

                    Settings.Save();
                }
            }
        }
예제 #3
0
        protected void OnMouseHover(object sender, System.EventArgs e)
        {
            if (tipWindow != null)
            {
                tipWindow.Close();
            }

            if (hoverIndex >= 0)
            {
                Graphics g = Graphics.FromHwnd(Handle);

                Rectangle itemRect = GetItemRectangle(hoverIndex);
//				itemRect.Offset( 17, 0 );
//				itemRect.Width -= 17;

                string text = Items[hoverIndex] as string;

                SizeF sizeNeeded      = g.MeasureString(text, Font);
                bool  expansionNeeded =
                    itemRect.Width < (int)sizeNeeded.Width ||
                    itemRect.Height < (int)sizeNeeded.Height;

                if (expansionNeeded)
                {
                    tipWindow                 = new TipWindow(this, hoverIndex);
                    tipWindow.ItemBounds      = itemRect;
                    tipWindow.TipText         = text;
                    tipWindow.Expansion       = TipWindow.ExpansionStyle.Horizontal;
                    tipWindow.Overlay         = true;
                    tipWindow.WantClicks      = true;
                    tipWindow.AutoCloseDelay  = this.AutoCloseDelay;
                    tipWindow.MouseLeaveDelay = this.MouseLeaveDelay;
                    tipWindow.Closed         += new EventHandler(tipWindow_Closed);
                    tipWindow.Show();
                }
            }
        }