Search code examples
c#tooltippicturebox

PictureBox Tooltip changing C#


Ok so I am a complete beginner and have managed to put together a small app in C# where I enter a username in a textbox and the application gets the avatar of that username and displays it in a picturebox.

What i want to do is have a tooltip show the username that was typed in the textbox when mouse hovers over the loaded avatar. it should change each time a new avatar is loaded. I know how to use tooltips the normal way but this is a bit complex for me. Any help will be appreciated.

Thanks.


Solution

  • Add a hover event to your picturebox with the following code.

    private void pictureBox1_MouseHover(object sender, EventArgs e)
    {
        ToolTip tt = new ToolTip();
        tt.SetToolTip(this.pictureBox1, "Your username");
    }