Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 525
  • Last Modified:

Display the tooltip of the toolbar-buttons and the hint text of menuStrip-items in the statusStrip.

Hi,

How can I display the tooltip of the toolbar-buttons and the hints of menuStrip-items in the statusStrip?

Who knows the answer and is willing to help me?

Greetings,

Peter Kiers
0
peterkiers
Asked:
peterkiers
  • 3
  • 2
1 Solution
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Try something like this:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            foreach (ToolStripItem tsi in toolStrip1.Items)
            {
                if (tsi is ToolStripButton)
                {
                    tsi.MouseEnter += new EventHandler(toolStripButton_MouseEnter);
                    tsi.MouseLeave += new EventHandler(toolStripButton_MouseLeave);
                }
            }
            foreach (ToolStripItem tsi in menuStrip1.Items)
            {
                ToolStripMenuItem tsmi = (ToolStripMenuItem)tsi;
                tsi.MouseEnter += new EventHandler(toolStripButton_MouseEnter);
                tsi.MouseLeave += new EventHandler(toolStripButton_MouseLeave);
                WireUpMenuItems(tsmi);
            }
        }

        private void WireUpMenuItems(ToolStripMenuItem tsmi)
        {
            foreach (ToolStripMenuItem tsmi2 in tsmi.DropDownItems)
            {
                tsmi2.MouseEnter += new EventHandler(toolStripButton_MouseEnter);
                tsmi2.MouseLeave += new EventHandler(toolStripButton_MouseLeave);
                WireUpMenuItems(tsmi2);
            }
        }

        void toolStripButton_MouseEnter(object sender, EventArgs e)
        {
            ToolStripItem tsi = (ToolStripItem)sender;
            toolStripStatusLabel1.Text = tsi.ToolTipText;
        }

        void toolStripButton_MouseLeave(object sender, EventArgs e)
        {
            toolStripStatusLabel1.Text = "";
        }

    }
}

Open in new window

0
 
vopCommented:
Does it look as if the tool tips are displaying but are partly hidden by the taskbar, or that the tooltips are not being displayed at all?

Win95 has a bug which Microsoft have never fixed and seems to have propagated through the various Windows versions.

Tooltip fixer can be downloaded at:

http://neosmart.net/dl.php?id=10

0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
@vop...a StatusStrip is across the bottom of the Form:
http://msdn.microsoft.com/en-us/library/ms229738.aspx

StatusStripControl.jpg
0
 
vopCommented:
OK. Apologies. Just thought it might have been a mistype.

0
 
vopCommented:
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now