ScruffyDuck
ScruffyDuck

Reputation: 2666

How do I control the position of ToolTipText for a ToolStripStatusLabel

I have a ToolTipStatusLabel in a StatusStrip located at the bottom of a Windows Form. I want to show some information when the mouse hovers over it. I found the ToolTipText which does display but down and right. It seems to come up to some degree when the window is maximized but flickers badly as well (the display is a list so it could be quite long).

I cannot find a way to change the way the tip displays so that it goes up and right. Neither can I find a way to attach a ToolTip to the StatusLabel. I have read that I can control the location of a ToolTip using the Placement Properties but they are not available (as far as I can tell( for the StatusLable ToolTipText.

An alternative would be for me to handle this via the MouseEnter and MouseLeave events of the StatusLabel and write some sort of hown grown borderless window. I'd rather not if there is some other way.

Many thanks in advance

Upvotes: 3

Views: 4215

Answers (2)

Murat ÇELİK
Murat ÇELİK

Reputation: 1

Visual Studio 2017 ' ToolStripStatusLabel1 ToolTipText için;

Private Sub ssLDBStatus_MouseHover(sender As Object, e As EventArgs) Handles ssLDBStatus.MouseHover

    ToolTip1.SetToolTip(StatusStrip1, "test")

End Sub

Upvotes: 0

LarsTech
LarsTech

Reputation: 81610

Try attaching the tooltip to the StatusStrip control, and then from there, you should be able to show the tip on the label's MouseHover event:

ToolTip tt = new ToolTip();

public Form1() {
  InitializeComponent();
}

private void toolStripStatusLabel1_MouseHover(object sender, EventArgs e) {
  tt.Show("This is my tool tip", 
          statusStrip1,
          new Point(toolStripStatusLabel1.Bounds.Right, 
                    toolStripStatusLabel1.Bounds.Top - 10));
}

private void toolStripStatusLabel1_MouseLeave(object sender, EventArgs e) {
  tt.Hide(statusStrip1);
}

Upvotes: 4

Related Questions