Beispiel #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="e"></param>
 protected override void OnMouseEnter(EventArgs e)
 {
     base.OnMouseEnter(e);
     this.BackColor = MenConstants.LightGrey;
     this.ChildControlRefresh();
     if (this.Text != "")
     {
         tp.Show(this.Text, this, this.PointToClient(new Point(Cursor.Position.X + 10, Cursor.Position.Y + 30)));
     }
     else
     {
         tp.Show(this.ToolTipText, this, this.PointToClient(new Point(Cursor.Position.X + 10, Cursor.Position.Y + 30)));
     }
 }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void titleBarBtn_MouseHover(object sender, EventArgs e)
        {
            Button btn     = sender as Button;
            var    btnName = btn.Name;

            btn.BackColor = MenConstants.TitleBarBtnMouseHoverColor;
            string toolTipText = string.Empty;

            if (btnName == "minimizeBtn")
            {
                toolTipText = "Minimize";
            }
            else if (btnName == "maximizeBtn")
            {
                if (CurrentWindowsState == MenWindowsState.Maximized)
                {
                    toolTipText = "Restore down";
                }
                else
                {
                    toolTipText = "Maximize";
                }
            }
            else if (btnName == "closeBtn")
            {
                toolTipText = "Close";
            }
            Point cursorPosition = btn.Location;

            formToolTip.Show(toolTipText, btn, 10, 30);
        }
Beispiel #3
0
        /// <summary>
        /// tooltip show based on the timer
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void timer_Tick(object sender, EventArgs e)
        {
            timer.Stop();
            try
            {
                Point currentMouseOverPoint;
                if (ToolTipShowUp)
                {
                    currentMouseOverPoint = this.PointToClient(new Point(Control.MousePosition.X, Control.MousePosition.Y - Cursor.Current.Size.Height + Cursor.Current.HotSpot.Y));
                }
                else
                {
                    currentMouseOverPoint = this.PointToClient(new Point(Control.MousePosition.X, Control.MousePosition.Y + Cursor.Current.Size.Height - Cursor.Current.HotSpot.Y));
                }

                if (mouseOverItem == null)
                {
                    if (ToolTipText != null && ToolTipText.Length > 0)
                    {
                        if (Tooltip == null)
                        {
                            Tooltip = new MenToolTip();
                        }
                        Tooltip.Show(ToolTipText, this, currentMouseOverPoint, ToolTipInterval);
                    }
                }
                else if ((!(mouseOverItem is ToolStripDropDownButton) && !(mouseOverItem is ToolStripSplitButton)) ||
                         ((mouseOverItem is ToolStripDropDownButton) && !((ToolStripDropDownButton)mouseOverItem).DropDown.Visible) ||
                         (((mouseOverItem is ToolStripSplitButton) && !((ToolStripSplitButton)mouseOverItem).DropDown.Visible)))
                {
                    if (mouseOverItem.ToolTipText != null && mouseOverItem.ToolTipText.Length > 0 && Tooltip != null)
                    {
                        if (Tooltip == null)
                        {
                            Tooltip = new MenToolTip();
                        }
                        Tooltip.Show(mouseOverItem.ToolTipText, this, currentMouseOverPoint, ToolTipInterval);
                    }
                }
            }
            catch
            { }
        }